diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-07 15:24:32 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-07 15:24:32 +0200 |
commit | 1e06cabf4a8fa4d4c7acb9898682a5b4b41a9f58 (patch) | |
tree | 1dc00333ddcb0d926bf289312b05ff14a6f81949 /app/controllers/projects/builds_controller.rb | |
parent | 3fa2cb93353720e1b70e01ec9e664ebf54d1fc29 (diff) | |
download | gitlab-ce-cleanup-ci-pages.tar.gz |
Remove Ci::Commit and Ci::Build controllerscleanup-ci-pages
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/projects/builds_controller.rb')
-rw-r--r-- | app/controllers/projects/builds_controller.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb index 76c7f31f61b..4e4ac6689d3 100644 --- a/app/controllers/projects/builds_controller.rb +++ b/app/controllers/projects/builds_controller.rb @@ -2,6 +2,8 @@ class Projects::BuildsController < Projects::ApplicationController before_action :ci_project before_action :build + before_action :authorize_admin_project!, except: [:show, :status] + layout "project" def show @@ -17,9 +19,37 @@ class Projects::BuildsController < Projects::ApplicationController end end + def retry + if @build.commands.blank? + return page_404 + end + + build = Ci::Build.retry(@build) + + if params[:return_to] + redirect_to URI.parse(params[:return_to]).path + else + redirect_to build_path(build) + end + end + + def status + render json: @build.to_json(only: [:status, :id, :sha, :coverage], methods: :sha) + end + + def cancel + @build.cancel + + redirect_to build_path(@build) + end + private def build @build ||= ci_project.builds.unscoped.find_by!(id: params[:id]) end + + def build_path(build) + namespace_project_build_path(build.gl_project.namespace, build.gl_project, build) + end end |