2016-07-20 08:33:13 -04:00
|
|
|
class Projects::PipelinesSettingsController < Projects::ApplicationController
|
|
|
|
before_action :authorize_admin_pipeline!
|
|
|
|
|
|
|
|
def show
|
2017-01-23 17:19:39 -05:00
|
|
|
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project, params: params)
|
2016-07-20 08:33:13 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
if @project.update_attributes(update_params)
|
2016-07-20 08:48:23 -04:00
|
|
|
flash[:notice] = "CI/CD Pipelines settings for '#{@project.name}' were successfully updated."
|
2017-01-23 17:19:39 -05:00
|
|
|
redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project)
|
2016-07-20 08:33:13 -04:00
|
|
|
else
|
2016-11-22 10:12:47 -05:00
|
|
|
render 'show'
|
2016-07-20 08:33:13 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def create_params
|
|
|
|
params.require(:pipeline).permit(:ref)
|
|
|
|
end
|
|
|
|
|
|
|
|
def update_params
|
|
|
|
params.require(:project).permit(
|
|
|
|
:runners_token, :builds_enabled, :build_allow_git_fetch, :build_timeout_in_minutes, :build_coverage_regex,
|
2017-02-19 17:17:24 -05:00
|
|
|
:public_builds, :auto_cancel_pending_pipelines
|
2016-07-20 08:33:13 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|