Add has_trace to Projects::JobController#show.json

closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51925
This commit is contained in:
Steve Azzopardi 2018-09-27 09:04:51 +02:00
parent c052f5a942
commit 0599a25f95
No known key found for this signature in database
GPG Key ID: 605BD4706E7DB47D
4 changed files with 27 additions and 1 deletions

View File

@ -7,6 +7,7 @@ class BuildDetailsEntity < JobEntity
expose :coverage, :erased_at, :duration
expose :tag_list, as: :tags
expose :has_trace?, as: :has_trace
expose :user, using: UserEntity
expose :runner, using: RunnerEntity
expose :pipeline, using: PipelineEntity

View File

@ -0,0 +1,5 @@
---
title: Expose has_trace in job API
merge_request: 21950
author:
type: other

View File

@ -337,6 +337,22 @@ describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
end
end
context 'when no trace is available' do
it 'has_trace is false' do
expect(response).to match_response_schema('job/job_details')
expect(json_response['has_trace']).to be false
end
end
context 'when job has trace' do
let(:job) { create(:ci_build, :running, :trace_live, pipeline: pipeline) }
it "has_trace is true" do
expect(response).to match_response_schema('job/job_details')
expect(json_response['has_trace']).to be true
end
end
end
context 'when requesting JSON job is triggered' do

View File

@ -3,12 +3,16 @@
{ "$ref": "job.json" }
],
"description": "An extension of job.json with more detailed information",
"required": [
"has_trace"
],
"properties": {
"artifact": { "$ref": "artifact.json" },
"terminal_path": { "type": "string" },
"trigger": { "$ref": "trigger.json" },
"deployment_status": { "$ref": "deployment_status.json" },
"runner": { "$ref": "runner.json" },
"runners": { "type": "runners.json" }
"runners": { "type": "runners.json" },
"has_trace": { "type": "boolean" }
}
}