diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-06-23 16:46:36 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-06-24 13:23:20 +0300 |
commit | 21fc25fd8efc6fc1196fd26d59f5b5e776240e83 (patch) | |
tree | 11775dbd120dacc706edb7235e50095af693fbb2 /app/controllers | |
parent | 3825fac65ba2e36620f7d50a8e52fc242ac0d710 (diff) | |
download | gitlab-ci-21fc25fd8efc6fc1196fd26d59f5b5e776240e83.tar.gz |
Ability to cancel all builds in the commit at once
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/commits_controller.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb index 06c24d6..88306f3 100644 --- a/app/controllers/commits_controller.rb +++ b/app/controllers/commits_controller.rb @@ -3,7 +3,8 @@ class CommitsController < ApplicationController before_filter :authenticate_public_page!, only: :show before_filter :project before_filter :commit - before_filter :authorize_access_project!, except: [:status, :show] + before_filter :authorize_access_project!, except: [:status, :show, :cancel] + before_filter :authorize_project_developer!, only: [:cancel] def show @builds = @commit.builds @@ -13,6 +14,12 @@ class CommitsController < ApplicationController render json: @commit.to_json(only: [:id, :sha], methods: [:status, :coverage]) end + def cancel + commit.builds.running_or_pending.each(&:cancel) + + redirect_to project_ref_commit_path(project, commit.ref, commit.sha) + end + private def project |