diff --git a/app/controllers/projects/builds_controller.rb b/app/controllers/projects/builds_controller.rb index f159e169f6d03224472a64ba7f59575b8b0b2eb4..c45e9809a83521156c21644116698df29c8cb607 100644 --- a/app/controllers/projects/builds_controller.rb +++ b/app/controllers/projects/builds_controller.rb @@ -1,7 +1,7 @@ class Projects::BuildsController < Projects::ApplicationController 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] + before_action :authorize_update_build!, except: [:index, :show, :status, :raw_trace] layout 'project' def index @@ -62,6 +62,14 @@ class Projects::BuildsController < Projects::ApplicationController notice: "Build has been sucessfully erased!" end + def raw + if @build.has_trace? + render json: { trace_file: @build.path_to_trace } + else + render json: {}, status: 404 + end + end + private def build diff --git a/app/views/projects/builds/show.html.haml b/app/views/projects/builds/show.html.haml index aa8827b5ac86d4e3bc9f13bca3e9a477a6bdeffa..bacfa594ba03936c2c0857e7c525abb767b1b14c 100644 --- a/app/views/projects/builds/show.html.haml +++ b/app/views/projects/builds/show.html.haml @@ -127,6 +127,9 @@ data: { confirm: 'Are you sure you want to erase this build?' } do = icon('eraser') Erase + - if @build.has_trace? + = link_to 'Raw', raw_namespace_project_build_path(@project.namespace, @project, @build), + class: 'btn btn-sm btn-success', target: '_blank' .clearfix - if @build.duration diff --git a/config/routes.rb b/config/routes.rb index b9f30ede524f5e5882e0b6f254a72569be3abbd4..bc48728470fb5e795b3a019ff8a68e761ae96484 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -669,6 +669,7 @@ Rails.application.routes.draw do post :cancel post :retry post :erase + get :raw, format: false end resource :artifacts, only: [] do