2016-07-20 08:33:13 -04:00
|
|
|
class Projects::PipelinesSettingsController < Projects::ApplicationController
|
|
|
|
before_action :authorize_admin_pipeline!
|
|
|
|
|
|
|
|
def show
|
|
|
|
@ref = params[:ref] || @project.default_branch || 'master'
|
2016-08-12 08:30:17 -04:00
|
|
|
|
|
|
|
@badges = [Gitlab::Badge::Build::Status,
|
|
|
|
Gitlab::Badge::Coverage::Report]
|
|
|
|
|
|
|
|
@badges.map! do |badge|
|
|
|
|
badge.new(@project, @ref).metadata
|
|
|
|
end
|
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."
|
2016-07-20 08:54:15 -04:00
|
|
|
redirect_to namespace_project_pipelines_settings_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,
|
|
|
|
:public_builds
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|