Commit 0027a7aa authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch 'mc/feature/add-external-validation-description' into 'master'

Add pipeline validation failure description

Closes #55695

See merge request gitlab-org/gitlab!21780
parents 66a3b645 020516f9
...@@ -8,7 +8,9 @@ module Ci ...@@ -8,7 +8,9 @@ module Ci
# We use a class method here instead of a constant, allowing EE to redefine # We use a class method here instead of a constant, allowing EE to redefine
# the returned `Hash` more easily. # the returned `Hash` more easily.
def self.failure_reasons def self.failure_reasons
{ config_error: 'CI/CD YAML configuration error!' } { unknown_failure: 'Unknown pipeline failure!',
config_error: 'CI/CD YAML configuration error!',
external_validation_failure: 'External pipeline validation failed!' }
end end
presents :pipeline presents :pipeline
......
...@@ -12,7 +12,8 @@ module EE ...@@ -12,7 +12,8 @@ module EE
def failure_reasons def failure_reasons
super.merge( super.merge(
activity_limit_exceeded: 'Pipeline activity limit exceeded!', activity_limit_exceeded: 'Pipeline activity limit exceeded!',
size_limit_exceeded: 'Pipeline size limit exceeded!' size_limit_exceeded: 'Pipeline size limit exceeded!',
job_activity_limit_exceeded: 'Pipeline job activity limit exceeded!'
) )
end end
end end
......
...@@ -62,13 +62,19 @@ describe Ci::PipelinePresenter do ...@@ -62,13 +62,19 @@ describe Ci::PipelinePresenter do
end end
end end
context '#failure_reason' do describe '#failure_reason' do
context 'when pipeline has failure reason' do context 'when pipeline has a failure reason' do
it 'represents a failure reason sentence' do ::Ci::PipelineEnums.failure_reasons.keys.each do |failure_reason|
pipeline.failure_reason = :config_error context "when failure reason is #{failure_reason}" do
before do
pipeline.failure_reason = failure_reason
end
expect(presenter.failure_reason) it 'represents a failure reason sentence' do
.to eq 'CI/CD YAML configuration error!' expect(presenter.failure_reason).to be_an_instance_of(String)
expect(presenter.failure_reason).not_to eq(failure_reason.to_s)
end
end
end end
end end
......
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