summaryrefslogtreecommitdiff
path: root/app/controllers/projects/pipelines_settings_controller.rb
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2017-11-17 17:24:40 +0100
committerEric Eastwood <contact@ericeastwood.com>2017-11-28 12:42:08 -0600
commita4a389a0a7314d011275592474bd974924f86735 (patch)
tree3469be680f8e0cf5931cb54fa784a86389e43d0f /app/controllers/projects/pipelines_settings_controller.rb
parenta7f6ab952acc58e7ef9a33fba3fbaaa0918572fe (diff)
downloadgitlab-ce-a4a389a0a7314d011275592474bd974924f86735.tar.gz
BE for automatic pipeline when enabling Auto DevOps
Fix https://gitlab.com/gitlab-org/gitlab-ce/issues/38962
Diffstat (limited to 'app/controllers/projects/pipelines_settings_controller.rb')
-rw-r--r--app/controllers/projects/pipelines_settings_controller.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/app/controllers/projects/pipelines_settings_controller.rb b/app/controllers/projects/pipelines_settings_controller.rb
index abab2e2f0c9..e65495b420e 100644
--- a/app/controllers/projects/pipelines_settings_controller.rb
+++ b/app/controllers/projects/pipelines_settings_controller.rb
@@ -6,11 +6,18 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
end
def update
- if @project.update(update_params)
- flash[:notice] = "Pipelines settings for '#{@project.name}' were successfully updated."
- redirect_to project_settings_ci_cd_path(@project)
- else
- render 'show'
+ Projects::UpdateService.new(project, current_user, update_params).tap do |service|
+ if service.execute
+ flash[:notice] = "Pipelines settings for '#{@project.name}' were successfully updated."
+
+ if service.run_auto_devops_pipeline?
+ CreatePipelineWorker.perform_async(project.id, current_user.id, project.default_branch, :web, ignore_skip_ci: true, save_on_errors: false)
+ end
+
+ redirect_to project_settings_ci_cd_path(@project)
+ else
+ render 'show'
+ end
end
end
@@ -21,6 +28,7 @@ class Projects::PipelinesSettingsController < Projects::ApplicationController
:runners_token, :builds_enabled, :build_allow_git_fetch,
:build_timeout_in_minutes, :build_coverage_regex, :public_builds,
:auto_cancel_pending_pipelines, :ci_config_path,
+ :run_auto_devops_pipeline_implicit, :run_auto_devops_pipeline_explicit,
auto_devops_attributes: [:id, :domain, :enabled]
)
end