Add has_trace to Projects::JobController#show.json

closes https://gitlab.com/gitlab-org/gitlab-ce/issues/51925
上级 c052f5a9
......@@ -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
......
---
title: Expose has_trace in job API
merge_request: 21950
author:
type: other
......@@ -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
......
......@@ -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" }
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册