Skip to content
Snippets Groups Projects
Commit 02b9b5fa authored by Tiger Watson's avatar Tiger Watson
Browse files

Expose build failure reason

We can use this to show more informative error messages with
links to documentation etc.
parent de03a8bc
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -45,6 +45,8 @@ class BuildDetailsEntity < JobEntity
erase_project_job_path(project, build)
end
 
expose :failure_reason, if: -> (*) { build.failed? }
expose :terminal_path, if: -> (*) { can_create_build_terminal? } do |build|
terminal_project_job_path(project, build)
end
Loading
Loading
Loading
Loading
@@ -112,5 +112,15 @@ describe BuildDetailsEntity do
expect(subject['merge_request_path']).to be_nil
end
end
context 'when the build has failed' do
let(:build) { create(:ci_build, :created) }
before do
build.drop!(:unmet_prerequisites)
end
it { is_expected.to include(failure_reason: 'unmet_prerequisites') }
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment