From 8fac12c590e808537c447119343f860f269eb67d Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 22 Mar 2016 15:25:53 +0100 Subject: [PATCH 1/3] Fix build dependencies, when the dependency is a string --- CHANGELOG | 1 + lib/ci/gitlab_ci_yaml_processor.rb | 4 ++-- spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2a52c428273..6462b7188c9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,7 @@ v 8.6.0 - Fix diff image view modes (2-up, swipe, onion skin) not working (Stan Hu) - Support Golang subpackage fetching (Stan Hu) - Bump Capybara gem to 2.6.2 (Stan Hu) + - Fix build dependencies, when the dependency is a string - New branch button appears on issues where applicable - Contributions to forked projects are included in calendar - Improve the formatting for the user page bio (Connor Shea) 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..d9812032c85 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -492,19 +492,19 @@ module Ci end context 'dependencies to builds' do - let(:dependencies) { [:build1, :build2] } + 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 From 858bf727bc4841bf5bbcff7348fd46ea2090e753 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 22 Mar 2016 15:27:55 +0100 Subject: [PATCH 2/3] Test dependencies defined as symbols --- spec/lib/ci/gitlab_ci_yaml_processor_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb index d9812032c85..dcb8a3451bd 100644 --- a/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb +++ b/spec/lib/ci/gitlab_ci_yaml_processor_spec.rb @@ -497,6 +497,12 @@ module Ci 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'] } From 68c0dc1fbe99e2f72826e4806a745c5e5e4405f3 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 22 Mar 2016 18:30:37 +0100 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 6462b7188c9..4652ebb1136 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ v 8.7.0 (unreleased) v 8.6.1 (unreleased) - Do not allow to move issue if it has not been persisted - Fix an issue causing the Dashboard/Milestones page to be blank + - Fix build dependencies, when the dependency is a string v 8.6.0 - Add ability to move issue to another project @@ -16,7 +17,6 @@ v 8.6.0 - Fix diff image view modes (2-up, swipe, onion skin) not working (Stan Hu) - Support Golang subpackage fetching (Stan Hu) - Bump Capybara gem to 2.6.2 (Stan Hu) - - Fix build dependencies, when the dependency is a string - New branch button appears on issues where applicable - Contributions to forked projects are included in calendar - Improve the formatting for the user page bio (Connor Shea)