diff options
author | Rémy Coutable <remy@rymai.me> | 2016-03-23 11:58:12 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-03-23 12:59:29 +0100 |
commit | f45b9bdef0c9f087e260a9ce2f38d225478c4564 (patch) | |
tree | a9b926b6df8548e3ae526be605079e62edcb9694 | |
parent | 83961f97906ff1b76e1499795e55349460a1d3f8 (diff) | |
download | gitlab-ce-f45b9bdef0c9f087e260a9ce2f38d225478c4564.tar.gz |
Merge branch 'fix-build-dependencies' into 'master'
Fix build dependencies, when the dependency is a string
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/14485
See merge request !3344
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 4 | ||||
-rw-r--r-- | spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 10 |
3 files changed, 11 insertions, 4 deletions
diff --git a/CHANGELOG b/CHANGELOG index ce867c93442..ed660ea7ed5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ v 8.6.1 (unreleased) - Add a confirmation step before deleting an issuable. !3341 - Fixes issue with signin button overflowing on mobile. !3342 - Auto collapses the navigation sidebar when resizing. !3343 + - Fix build dependencies, when the dependency is a string. !3344 - Shows error messages when trying to create label in dropdown menu. !3345 - Fixes issue with assign milestone not loading milestone list. !3346 - Fix an issue causing the Dashboard/Milestones page to be blank. !3348 diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index 2228425076b..b7209c14148 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -242,9 +242,9 @@ module Ci stage_index = stages.index(job[:stage]) job[:dependencies].each do |dependency| - raise ValidationError, "#{name} job: undefined dependency: #{dependency}" unless @jobs[dependency] + raise ValidationError, "#{name} job: undefined dependency: #{dependency}" unless @jobs[dependency.to_sym] - unless stages.index(@jobs[dependency][:stage]) < stage_index + unless stages.index(@jobs[dependency.to_sym][:stage]) < stage_index raise ValidationError, "#{name} job: dependency #{dependency} is not defined in prior stages" end end diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb index b79b8147ce0..dcb8a3451bd 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -492,19 +492,25 @@ module Ci end context 'dependencies to builds' do + let(:dependencies) { ['build1', 'build2'] } + + it { expect { subject }.to_not raise_error } + end + + context 'dependencies to builds defined as symbols' do let(:dependencies) { [:build1, :build2] } it { expect { subject }.to_not raise_error } end context 'undefined dependency' do - let(:dependencies) { [:undefined] } + let(:dependencies) { ['undefined'] } it { expect { subject }.to raise_error(GitlabCiYamlProcessor::ValidationError, 'test1 job: undefined dependency: undefined') } end context 'dependencies to deploy' do - let(:dependencies) { [:deploy] } + let(:dependencies) { ['deploy'] } it { expect { subject }.to raise_error(GitlabCiYamlProcessor::ValidationError, 'test1 job: dependency deploy is not defined in prior stages') } end |