summaryrefslogtreecommitdiff
path: root/app/controllers/projects/pipelines_settings_controller.rb
blob: abab2e2f0c9209faaf9287cb54dd18f34545c4ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class Projects::PipelinesSettingsController < Projects::ApplicationController
  before_action :authorize_admin_pipeline!

  def show
    redirect_to project_settings_ci_cd_path(@project, params: params)
  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'
    end
  end

  private

  def update_params
    params.require(:project).permit(
      :runners_token, :builds_enabled, :build_allow_git_fetch,
      :build_timeout_in_minutes, :build_coverage_regex, :public_builds,
      :auto_cancel_pending_pipelines, :ci_config_path,
      auto_devops_attributes: [:id, :domain, :enabled]
    )
  end
end