Commit 7a5156d6 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '21744-fix-missing-values-in-linter' into 'master'

Add missing values to linter (`only`, `except`) and add new one `Environment`

Closes #21744 

See merge request !6276
parents 9a79c9e9 e26ea861
......@@ -17,6 +17,7 @@ v 8.13.0 (unreleased)
- Only update issuable labels if they have been changed
- Take filters in account in issuable counters. !6496
- Revoke button in Applications Settings underlines on hover.
- Add missing values to linter !6276 (Katarzyna Kobierska Ula Budziszewska)
- Fix Long commit messages overflow viewport in file tree
- Revert avoid touching file system on Build#artifacts?
- Update ruby-prof to 0.16.2. !6026 (Elan Ruusamäe)
......
......@@ -14,6 +14,7 @@ module Ci
@config_processor = Ci::GitlabCiYamlProcessor.new(@content)
@stages = @config_processor.stages
@builds = @config_processor.builds
@jobs = @config_processor.jobs
end
rescue
@error = 'Undefined error'
......
......@@ -21,13 +21,16 @@
%br
%b Tag list:
= build[:tags]
= build[:tag_list].to_a.join(", ")
%br
%b Refs only:
= build[:only] && build[:only].join(", ")
= @jobs[build[:name].to_sym][:only].to_a.join(", ")
%br
%b Refs except:
= build[:except] && build[:except].join(", ")
= @jobs[build[:name].to_sym][:except].to_a.join(", ")
%br
%b Environment:
= build[:environment]
%br
%b When:
= build[:when]
......
......@@ -4,7 +4,7 @@ module Ci
include Gitlab::Ci::Config::Node::LegacyValidationHelpers
attr_reader :path, :cache, :stages
attr_reader :path, :cache, :stages, :jobs
def initialize(config, path = nil)
@ci_config = Gitlab::Ci::Config.new(config)
......
require 'spec_helper'
describe 'ci/lints/show' do
let(:content) do
{
build_template: {
script: './build.sh',
tags: ['dotnet'],
only: ['test@dude/repo'],
except: ['deploy'],
environment: 'testing'
}
}
end
let(:config_processor) { Ci::GitlabCiYamlProcessor.new(YAML.dump(content)) }
context 'when the content is valid' do
before do
assign(:status, true)
assign(:builds, config_processor.builds)
assign(:stages, config_processor.stages)
assign(:jobs, config_processor.jobs)
end
it 'shows the correct values' do
render
expect(rendered).to have_content('Tag list: dotnet')
expect(rendered).to have_content('Refs only: test@dude/repo')
expect(rendered).to have_content('Refs except: deploy')
expect(rendered).to have_content('Environment: testing')
expect(rendered).to have_content('When: on_success')
end
end
context 'when the content is invalid' do
before do
assign(:status, false)
assign(:error, 'Undefined error')
end
it 'shows error message' do
render
expect(rendered).to have_content('Status: syntax is incorrect')
expect(rendered).to have_content('Error: Undefined error')
expect(rendered).not_to have_content('Tag list:')
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