Commit 31861497 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'sh-fix-ci-lint-errors' into 'master'

Gracefully handle CI lint errors in artifacts section

Closes #194069

See merge request gitlab-org/gitlab!22388
parents 870c49ae 53bac5ca
---
title: Gracefully error handle CI lint errors in artifacts section
merge_request: 22388
author:
type: fixed
......@@ -54,6 +54,11 @@ module Gitlab
def expose_as_present?
return false unless Feature.enabled?(:ci_expose_arbitrary_artifacts_in_mr, default_enabled: true)
# This duplicates the `validates :config, type: Hash` above,
# but Validatable currently doesn't halt the validation
# chain if it encounters a validation error.
return false unless @config.is_a?(Hash)
!@config[:expose_as].nil?
end
end
......
......@@ -1270,6 +1270,19 @@ module Gitlab
expect(builds.first[:options][:artifacts][:when]).to eq(when_state)
end
end
it "gracefully handles errors in artifacts type" do
config = <<~YAML
test:
script:
- echo "Hello world"
artifacts:
- paths:
- test/
YAML
expect { described_class.new(config) }.to raise_error(described_class::ValidationError)
end
end
describe '#environment' 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