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
Léo-Paul Géneau
gitlab-ce
Commits
94d5f568
Commit
94d5f568
authored
Nov 02, 2017
by
Alessio Caiazza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract ClusterWaitForAppInstallationWorker logic into a service
parent
a8d7e4bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
20 deletions
+30
-20
app/services/clusters/check_app_installation_progress_service.rb
...vices/clusters/check_app_installation_progress_service.rb
+28
-0
app/services/clusters/install_app_service.rb
app/services/clusters/install_app_service.rb
+1
-1
app/workers/cluster_wait_for_app_installation_worker.rb
app/workers/cluster_wait_for_app_installation_worker.rb
+1
-19
No files found.
app/services/clusters/check_app_installation_progress_service.rb
0 → 100644
View file @
94d5f568
module
Clusters
class
CheckAppInstallationProgressService
<
BaseHelmService
def
execute
return
unless
app
.
installing?
FetchAppInstallationStatusService
.
new
(
app
).
execute
do
|
phase
,
log
|
case
phase
when
'Succeeded'
if
app
.
make_installed
FinalizeAppInstallationService
.
new
(
app
).
execute
else
app
.
make_errored!
(
"Failed to update app record;
#{
app
.
errors
}
"
)
end
when
'Failed'
app
.
make_errored!
(
log
||
'Installation silently failed'
)
FinalizeAppInstallationService
.
new
(
app
).
execute
else
if
Time
.
now
.
utc
-
app
.
updated_at
.
to_time
.
utc
>
ClusterWaitForAppInstallationWorker
::
TIMEOUT
app
.
make_errored!
(
'App installation timeouted'
)
else
ClusterWaitForAppInstallationWorker
.
perform_in
(
ClusterWaitForAppInstallationWorker
::
EAGER_INTERVAL
,
app
.
name
,
app
.
id
)
end
end
end
end
end
end
app/services/clusters/install_app_service.rb
View file @
94d5f568
...
...
@@ -14,7 +14,7 @@ module Clusters
end
rescue
KubeException
=>
ke
app
.
make_errored!
(
"Kubernetes error:
#{
ke
.
message
}
"
)
rescue
StandardError
=>
e
rescue
StandardError
app
.
make_errored!
(
"Can't start installation process"
)
end
end
...
...
app/workers/cluster_wait_for_app_installation_worker.rb
View file @
94d5f568
...
...
@@ -9,25 +9,7 @@ class ClusterWaitForAppInstallationWorker
def
perform
(
app_name
,
app_id
)
find_app
(
app_name
,
app_id
)
do
|
app
|
Clusters
::
FetchAppInstallationStatusService
.
new
(
app
).
execute
do
|
phase
,
log
|
case
phase
when
'Succeeded'
if
app
.
make_installed
Clusters
::
FinalizeAppInstallationService
.
new
(
app
).
execute
else
app
.
make_errored!
(
"Failed to update app record;
#{
app
.
errors
}
"
)
end
when
'Failed'
app
.
make_errored!
(
log
||
'Installation silently failed'
)
Clusters
::
FinalizeAppInstallationService
.
new
(
app
).
execute
else
if
Time
.
now
.
utc
-
app
.
updated_at
.
to_time
.
utc
>
TIMEOUT
app
.
make_errored!
(
'App installation timeouted'
)
else
ClusterWaitForAppInstallationWorker
.
perform_in
(
EAGER_INTERVAL
,
app
.
name
,
app
.
id
)
end
end
end
Clusters
::
CheckAppInstallationProgressService
.
new
(
app
).
execute
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