mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-20 18:16:45 +10:00
Merge branch 'feature/raw-trace-output' into 'master'
Add raw build trace output Closes #15308, #15147 Changes in the UI: - on finished build:  - on running build:  See merge request !3767
This commit is contained in:
@@ -99,6 +99,7 @@ v 8.7.0 (unreleased)
|
||||
- Execute system web hooks on push to the project
|
||||
- Allow enable/disable push events for system hooks
|
||||
- Fix GitHub project's link in the import page when provider has a custom URL
|
||||
- Add RAW build trace output and button on build page
|
||||
|
||||
v 8.6.7 (unreleased)
|
||||
- Fix vulnerability that made it possible to enumerate private projects belonging to group
|
||||
|
||||
@@ -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]
|
||||
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?
|
||||
send_file @build.path_to_trace, type: 'text/plain; charset=utf-8', disposition: 'inline'
|
||||
else
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def build
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
= icon('folder-open')
|
||||
Browse
|
||||
|
||||
.build-widget
|
||||
.build-widget.build-controls
|
||||
%h4.title
|
||||
Build ##{@build.id}
|
||||
- if can?(current_user, :update_build, @project)
|
||||
@@ -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
|
||||
|
||||
@@ -669,6 +669,7 @@ Rails.application.routes.draw do
|
||||
post :cancel
|
||||
post :retry
|
||||
post :erase
|
||||
get :raw
|
||||
end
|
||||
|
||||
resource :artifacts, only: [] do
|
||||
|
||||
@@ -86,6 +86,20 @@ describe "Builds" do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'Build raw trace' do
|
||||
before do
|
||||
@build.run!
|
||||
@build.trace = 'BUILD TRACE'
|
||||
visit namespace_project_build_path(@project.namespace, @project, @build)
|
||||
end
|
||||
|
||||
it do
|
||||
page.within('.build-controls') do
|
||||
expect(page).to have_link 'Raw'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "POST /:project/builds/:id/cancel" do
|
||||
@@ -120,4 +134,20 @@ describe "Builds" do
|
||||
|
||||
it { expect(page.response_headers['Content-Type']).to eq(artifacts_file.content_type) }
|
||||
end
|
||||
|
||||
describe "GET /:project/builds/:id/raw" do
|
||||
before do
|
||||
Capybara.current_session.driver.header('X-Sendfile-Type', 'X-Sendfile')
|
||||
@build.run!
|
||||
@build.trace = 'BUILD TRACE'
|
||||
visit namespace_project_build_path(@project.namespace, @project, @build)
|
||||
end
|
||||
|
||||
it 'sends the right headers' do
|
||||
page.within('.build-controls') { click_link 'Raw' }
|
||||
|
||||
expect(page.response_headers['Content-Type']).to eq('text/plain; charset=utf-8')
|
||||
expect(page.response_headers['X-Sendfile']).to eq(@build.path_to_trace)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user