summaryrefslogtreecommitdiff
path: root/app/services/clusters/applications/schedule_installation_service.rb
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-11-08 10:17:49 +0000
committerFilipa Lacerda <filipa@gitlab.com>2017-11-08 10:17:49 +0000
commit8c497e74094e5982c7ffc962d89089b79e1315ea (patch)
treebb0e659c7a7949a85a66122ac9399d4576645fec /app/services/clusters/applications/schedule_installation_service.rb
parentd4035c1132792a7e9cd40ed3be4d0b2f78411d90 (diff)
parentb579cc7620dad1d406e974cce2d9ad5a4ce58a57 (diff)
downloadgitlab-ce-38395-mr-widget-ci.tar.gz
Merge branch 'master' into 38395-mr-widget-ci38395-mr-widget-ci
* master: (120 commits) Remove comments in JSON. Add changelog Adds typescript support in webpack. With Mike G. Add note on registry restrictions on GitLab.com fix karma config file Remove truncate mixin Update mr_widget_options_spec.js Change cursor to pointer on hover Simplify design for no tags, branches Cleanup tests Improve GitLab Import rake task to work with Hashed Storage and Subgroups Upgrade vendored templates Remove EE-specific group paths Check redirecting with a querystring Update failure message when finding new routes in `PathRegex` Free up some group reserved words Free up `avatar`, `group_members` and `milestones` as paths Free up `labels` as a group name Add helper methods to redirect legacy paths Fix db/schema.rb ...
Diffstat (limited to 'app/services/clusters/applications/schedule_installation_service.rb')
-rw-r--r--app/services/clusters/applications/schedule_installation_service.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/app/services/clusters/applications/schedule_installation_service.rb b/app/services/clusters/applications/schedule_installation_service.rb
new file mode 100644
index 00000000000..eb8caa68ef7
--- /dev/null
+++ b/app/services/clusters/applications/schedule_installation_service.rb
@@ -0,0 +1,22 @@
+module Clusters
+ module Applications
+ class ScheduleInstallationService < ::BaseService
+ def execute
+ application_class.find_or_create_by!(cluster: cluster).try do |application|
+ application.make_scheduled!
+ ClusterInstallAppWorker.perform_async(application.name, application.id)
+ end
+ end
+
+ private
+
+ def application_class
+ params[:application_class]
+ end
+
+ def cluster
+ params[:cluster]
+ end
+ end
+ end
+end