summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2015-06-29 12:46:47 +0000
committerJacob Vosmaer <contact@jacobvosmaer.nl>2015-06-29 12:46:47 +0000
commitb1b232afe3d151dbbd535625298bfbe45f2523ec (patch)
tree387b66c2688ecafa146fcdd4e0f38b7ebb4e0428
parentc25cbe9a5892825ee84b2a295d7f65ffb77dbfd4 (diff)
parent90e625f69fb5160dab237968729729ac9ac0a068 (diff)
downloadgitlab-ci-b1b232afe3d151dbbd535625298bfbe45f2523ec.tar.gz
Merge branch 'only_section_to_stable' into '7-12-stable'
Fix list of branches in only section See merge request !175
-rw-r--r--CHANGELOG1
-rw-r--r--lib/gitlab_ci_yaml_processor.rb4
-rw-r--r--spec/lib/gitlab_ci_yaml_processor_spec.rb11
3 files changed, 14 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index dca464c..6d815fb 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@ v7.12.1
- Improved Lint stability
- Add warning when .gitlab-ci.yml not found
- Add one more validation rule for .gitlab-ci.yml
+ - Fix list of branches in only section
v7.12.0
- Endless scroll on the dashboard
diff --git a/lib/gitlab_ci_yaml_processor.rb b/lib/gitlab_ci_yaml_processor.rb
index a6806d3..18ce1ad 100644
--- a/lib/gitlab_ci_yaml_processor.rb
+++ b/lib/gitlab_ci_yaml_processor.rb
@@ -65,8 +65,8 @@ class GitlabCiYamlProcessor
return true if tag && only_params.include?("tags")
return true if !tag && only_params.include?("branches")
- only_params.each do |pattern|
- return match_ref?(pattern, ref)
+ only_params.find do |pattern|
+ match_ref?(pattern, ref)
end
else
return false if tag && except_params.include?("tags")
diff --git a/spec/lib/gitlab_ci_yaml_processor_spec.rb b/spec/lib/gitlab_ci_yaml_processor_spec.rb
index 070e0c0..155fcf1 100644
--- a/spec/lib/gitlab_ci_yaml_processor_spec.rb
+++ b/spec/lib/gitlab_ci_yaml_processor_spec.rb
@@ -117,6 +117,17 @@ describe GitlabCiYamlProcessor do
config_processor.deploy_builds_for_ref("master").size.should == 1
end
+
+ it "returns builds if only has a list of branches including specified" do
+ config = YAML.dump({
+ before_script: ["pwd"],
+ rspec: {script: "rspec", type: "deploy", only: ["master", "deploy"]}
+ })
+
+ config_processor = GitlabCiYamlProcessor.new(config)
+
+ config_processor.deploy_builds_for_ref("deploy").size.should == 1
+ end
end
describe "Error handling" do