Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
ea4af856
Commit
ea4af856
authored
Oct 04, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix cluster event names to be prefixed with: `make_`
parent
7329a034
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
14 deletions
+14
-14
app/models/gcp/cluster.rb
app/models/gcp/cluster.rb
+3
-3
app/services/ci/fetch_gcp_operation_service.rb
app/services/ci/fetch_gcp_operation_service.rb
+1
-1
app/services/ci/finalize_cluster_creation_service.rb
app/services/ci/finalize_cluster_creation_service.rb
+2
-2
app/services/ci/integrate_cluster_service.rb
app/services/ci/integrate_cluster_service.rb
+1
-1
app/services/ci/provision_cluster_service.rb
app/services/ci/provision_cluster_service.rb
+5
-5
app/workers/wait_for_cluster_creation_worker.rb
app/workers/wait_for_cluster_creation_worker.rb
+2
-2
No files found.
app/models/gcp/cluster.rb
View file @
ea4af856
...
...
@@ -67,15 +67,15 @@ module Gcp
validate
:restrict_modification
,
on: :update
,
unless: :status_changed?
state_machine
:status
,
initial: :scheduled
do
event
:creating
do
event
:
make_
creating
do
transition
any
-
[
:creating
]
=>
:creating
end
event
:created
do
event
:
make_
created
do
transition
any
-
[
:created
]
=>
:created
end
event
:errored
do
event
:
make_
errored
do
transition
any
-
[
:errored
]
=>
:errored
end
...
...
app/services/ci/fetch_gcp_operation_service.rb
View file @
ea4af856
...
...
@@ -11,7 +11,7 @@ module Ci
yield
(
operation
)
if
block_given?
rescue
Google
::
Apis
::
ServerError
,
Google
::
Apis
::
ClientError
,
Google
::
Apis
::
AuthorizationError
=>
e
return
cluster
.
errored!
(
"Failed to request to CloudPlatform;
#{
e
.
message
}
"
)
return
cluster
.
make_
errored!
(
"Failed to request to CloudPlatform;
#{
e
.
message
}
"
)
end
end
end
app/services/ci/finalize_cluster_creation_service.rb
View file @
ea4af856
...
...
@@ -10,7 +10,7 @@ module Ci
cluster
.
gcp_cluster_zone
,
cluster
.
gcp_cluster_name
)
rescue
Google
::
Apis
::
ServerError
,
Google
::
Apis
::
ClientError
,
Google
::
Apis
::
AuthorizationError
=>
e
return
cluster
.
errored!
(
"Failed to request to CloudPlatform;
#{
e
.
message
}
"
)
return
cluster
.
make_
errored!
(
"Failed to request to CloudPlatform;
#{
e
.
message
}
"
)
end
endpoint
=
gke_cluster
.
endpoint
...
...
@@ -23,7 +23,7 @@ module Ci
api_url
,
ca_cert
,
username
,
password
).
execute
unless
kubernetes_token
return
cluster
.
errored!
(
'Failed to get a default token of kubernetes'
)
return
cluster
.
make_
errored!
(
'Failed to get a default token of kubernetes'
)
end
Ci
::
IntegrateClusterService
.
new
.
execute
(
...
...
app/services/ci/integrate_cluster_service.rb
View file @
ea4af856
...
...
@@ -10,7 +10,7 @@ module Ci
username:
username
,
password:
password
,
service:
cluster
.
project
.
find_or_initialize_service
(
'kubernetes'
),
status_event: :created
)
status_event: :
make_
created
)
cluster
.
service
.
update!
(
active:
true
,
...
...
app/services/ci/provision_cluster_service.rb
View file @
ea4af856
...
...
@@ -12,24 +12,24 @@ module Ci
cluster
.
gcp_cluster_size
,
machine_type:
cluster
.
gcp_machine_type
)
rescue
Google
::
Apis
::
ServerError
,
Google
::
Apis
::
ClientError
,
Google
::
Apis
::
AuthorizationError
=>
e
return
cluster
.
errored!
(
"Failed to request to CloudPlatform;
#{
e
.
message
}
"
)
return
cluster
.
make_
errored!
(
"Failed to request to CloudPlatform;
#{
e
.
message
}
"
)
end
unless
operation
.
status
==
'RUNNING'
||
operation
.
status
==
'PENDING'
return
cluster
.
errored!
(
"Operation status is unexpected;
#{
operation
.
status_message
}
"
)
return
cluster
.
make_
errored!
(
"Operation status is unexpected;
#{
operation
.
status_message
}
"
)
end
cluster
.
gcp_operation_id
=
api_client
.
parse_operation_id
(
operation
.
self_link
)
unless
cluster
.
gcp_operation_id
return
cluster
.
errored!
(
'Can not find operation_id from self_link'
)
return
cluster
.
make_
errored!
(
'Can not find operation_id from self_link'
)
end
if
cluster
.
creating
if
cluster
.
make_
creating
WaitForClusterCreationWorker
.
perform_in
(
WaitForClusterCreationWorker
::
INITIAL_INTERVAL
,
cluster
.
id
)
else
return
cluster
.
errored!
(
"Failed to update cluster record;
#{
cluster
.
errors
}
"
)
return
cluster
.
make_
errored!
(
"Failed to update cluster record;
#{
cluster
.
errors
}
"
)
end
end
end
...
...
app/workers/wait_for_cluster_creation_worker.rb
View file @
ea4af856
...
...
@@ -12,14 +12,14 @@ class WaitForClusterCreationWorker
case
operation
.
status
when
'RUNNING'
if
TIMEOUT
<
Time
.
zone
.
now
-
operation
.
start_time
.
to_time
return
cluster
.
errored!
(
"Cluster creation time exceeds timeout;
#{
TIMEOUT
}
"
)
return
cluster
.
make_
errored!
(
"Cluster creation time exceeds timeout;
#{
TIMEOUT
}
"
)
end
WaitForClusterCreationWorker
.
perform_in
(
EAGER_INTERVAL
,
cluster
.
id
)
when
'DONE'
Ci
::
FinalizeClusterCreationService
.
new
.
execute
(
cluster
)
else
return
cluster
.
errored!
(
"Unexpected operation status;
#{
operation
.
status
}
#{
operation
.
status_message
}
"
)
return
cluster
.
make_
errored!
(
"Unexpected operation status;
#{
operation
.
status
}
#{
operation
.
status_message
}
"
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment