Commit 73c6ff98 authored by Kamil Trzciński's avatar Kamil Trzciński

Expose `failure_reasons` in `Build#features`

This makes us to expose a list of failure
reasons available for in a context of a given
build allowing Runner to sanitise what is being
sent.
parent d0d33e15
...@@ -564,7 +564,10 @@ module Ci ...@@ -564,7 +564,10 @@ module Ci
end end
def features def features
{ trace_sections: true } {
trace_sections: true,
failure_reasons: self.class.failure_reasons.keys
}
end end
def merge_request def merge_request
......
---
title: Expose `failure_reasons` in `Build#features`
merge_request:
author:
type: added
...@@ -198,7 +198,12 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do ...@@ -198,7 +198,12 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
'when' => 'on_success' }] 'when' => 'on_success' }]
end end
let(:expected_features) { { 'trace_sections' => true } } let(:expected_features) do
{
'trace_sections' => true,
'failure_reasons' => include('script_failure')
}
end
it 'picks a job' do it 'picks a job' do
request_job info: { platform: :darwin } request_job info: { platform: :darwin }
...@@ -220,7 +225,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do ...@@ -220,7 +225,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do
expect(json_response['artifacts']).to eq(expected_artifacts) expect(json_response['artifacts']).to eq(expected_artifacts)
expect(json_response['cache']).to eq(expected_cache) expect(json_response['cache']).to eq(expected_cache)
expect(json_response['variables']).to include(*expected_variables) expect(json_response['variables']).to include(*expected_variables)
expect(json_response['features']).to eq(expected_features) expect(json_response['features']).to match(expected_features)
end end
it 'creates persistent ref' do it 'creates persistent ref' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment