Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-07-20 00:26:13 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-07-20 00:26:13 +0300
commit4a74798a7ba16fec37f634d0eaf52b838213e090 (patch)
treee92a68f1b516a118d01f1e9cb61d90ccb86a3f80 /app/controllers
parent22be5aed1d6db526bd945f9492b806c29969676d (diff)
Move Pipelines settings under `gitlab.com/gitlab-org/gitlab-ce/pipelines/settings`
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/builds_controller.rb7
-rw-r--r--app/controllers/projects/pipelines_controller.rb33
-rw-r--r--app/controllers/projects/refs_controller.rb2
3 files changed, 34 insertions, 8 deletions
diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb
index b03a37d8148..d7513d75f01 100644
--- a/app/controllers/projects/builds_controller.rb
+++ b/app/controllers/projects/builds_controller.rb
@@ -1,5 +1,5 @@
class Projects::BuildsController < Projects::ApplicationController
- before_action :build, except: [:index, :cancel_all, :settings]
+ before_action :build, except: [:index, :cancel_all]
before_action :authorize_read_build!, except: [:cancel, :cancel_all, :retry]
before_action :authorize_update_build!, except: [:index, :show, :status, :raw]
layout 'project'
@@ -27,11 +27,6 @@ class Projects::BuildsController < Projects::ApplicationController
redirect_to namespace_project_builds_path(project.namespace, project)
end
- def settings
- @ref = params[:ref] || @project.default_branch || 'master'
- @build_badge = Gitlab::Badge::Build.new(@project, @ref)
- end
-
def show
@builds = @project.pipelines.find_by_sha(@build.sha).builds.order('id DESC')
@builds = @builds.where("id not in (?)", @build.id)
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb
index 487963fdcd7..990adb15133 100644
--- a/app/controllers/projects/pipelines_controller.rb
+++ b/app/controllers/projects/pipelines_controller.rb
@@ -1,9 +1,10 @@
class Projects::PipelinesController < Projects::ApplicationController
- before_action :pipeline, except: [:index, :new, :create]
+ before_action :pipeline, except: [:index, :new, :create, :settings, :update_settings]
before_action :commit, only: [:show]
before_action :authorize_read_pipeline!
before_action :authorize_create_pipeline!, only: [:new, :create]
before_action :authorize_update_pipeline!, only: [:retry, :cancel]
+ before_action :authorize_admin_pipeline!, only: [:settings, :update_settings]
def index
@scope = params[:scope]
@@ -43,12 +44,42 @@ class Projects::PipelinesController < Projects::ApplicationController
redirect_back_or_default default: namespace_project_pipelines_path(project.namespace, project)
end
+ def settings
+ @ref = params[:ref] || @project.default_branch || 'master'
+ @build_badge = Gitlab::Badge::Build.new(@project, @ref)
+ end
+
+ def update_settings
+ status = ::Projects::UpdateService.new(@project, current_user, pipelines_settings_params).execute
+
+ respond_to do |format|
+ if status
+ flash[:notice] = "CI/CD Pipelines settings for '#{@project.name}' was successfully updated."
+ format.html do
+ redirect_to(
+ settings_namespace_project_pipelines_path(@project.namespace, @project),
+ notice: "CI/CD Pipelines settings for '#{@project.name}' was successfully updated."
+ )
+ end
+ else
+ format.html { render 'settings' }
+ end
+ end
+ end
+
private
def create_params
params.require(:pipeline).permit(:ref)
end
+ def pipelines_settings_params
+ params.require(:project).permit(
+ :runners_token, :builds_enabled, :build_allow_git_fetch, :build_timeout_in_minutes, :build_coverage_regex,
+ :public_builds
+ )
+ end
+
def pipeline
@pipeline ||= project.pipelines.find_by!(id: params[:id])
end
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb
index 3b08573ca99..08d74634315 100644
--- a/app/controllers/projects/refs_controller.rb
+++ b/app/controllers/projects/refs_controller.rb
@@ -25,7 +25,7 @@ class Projects::RefsController < Projects::ApplicationController
when "graphs_commits"
commits_namespace_project_graph_path(@project.namespace, @project, @id)
when "badges"
- settings_namespace_project_builds_path(@project.namespace, @project, ref: @id)
+ settings_namespace_project_pipelines_path(@project.namespace, @project, ref: @id)
else
namespace_project_commits_path(@project.namespace, @project, @id)
end