BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e8e2a210
Commit
e8e2a210
authored
Oct 03, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename to ClusterProvisionWorker and CreateGkeClusterService.new.execute
parent
25a1ef69
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
create_cluster_service.rb
app/services/ci/create_cluster_service.rb
+1
-1
provision_cluster_service.rb
app/services/ci/provision_cluster_service.rb
+5
-5
cluster_provision_worker.rb
app/workers/cluster_provision_worker.rb
+2
-2
No files found.
app/services/ci/create_cluster_service.rb
View file @
e8e2a210
...
...
@@ -7,7 +7,7 @@ module Ci
params
.
merge
(
user:
current_user
,
status:
Gcp
::
Cluster
.
statuses
[
:scheduled
],
gcp_token:
access_token
)).
tap
do
|
cluster
|
Cluster
Creat
ionWorker
.
perform_async
(
cluster
.
id
)
if
cluster
.
persisted?
Cluster
Provis
ionWorker
.
perform_async
(
cluster
.
id
)
if
cluster
.
persisted?
end
end
end
...
...
app/services/ci/
create_gke
_cluster_service.rb
→
app/services/ci/
provision
_cluster_service.rb
View file @
e8e2a210
module
Ci
class
CreateGke
ClusterService
class
Provision
ClusterService
def
execute
(
cluster
)
api_client
=
GoogleApi
::
CloudPlatform
::
Client
.
new
(
cluster
.
gcp_token
,
nil
)
...
...
@@ -15,18 +15,18 @@ module Ci
rescue
Google
::
Apis
::
ServerError
,
Google
::
Apis
::
ClientError
,
Google
::
Apis
::
AuthorizationError
=>
e
return
cluster
.
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
}
"
)
end
operation_id
=
api_client
.
parse_operation_id
(
operation
.
self_link
)
cluster
.
gcp_
operation_id
=
api_client
.
parse_operation_id
(
operation
.
self_link
)
unless
operation_id
unless
cluster
.
gcp_
operation_id
return
cluster
.
errored!
(
'Can not find operation_id from self_link'
)
end
if
cluster
.
creating
!
(
operation_id
)
if
cluster
.
creating
WaitForClusterCreationWorker
.
perform_in
(
WaitForClusterCreationWorker
::
INITIAL_INTERVAL
,
cluster
.
id
)
else
...
...
app/workers/cluster_
creat
ion_worker.rb
→
app/workers/cluster_
provis
ion_worker.rb
View file @
e8e2a210
class
Cluster
Creat
ionWorker
class
Cluster
Provis
ionWorker
include
Sidekiq
::
Worker
include
ClusterQueue
def
perform
(
cluster_id
)
Gcp
::
Cluster
.
find_by_id
(
cluster_id
).
try
do
|
cluster
|
Ci
::
CreateGke
ClusterService
.
new
.
execute
(
cluster
)
Ci
::
Provision
ClusterService
.
new
.
execute
(
cluster
)
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