summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-06-29 14:52:09 +0300
committerValery Sizov <vsv2711@gmail.com>2015-06-29 15:11:18 +0300
commit5d14d52507352a4a0cb614f948dabbd85cc68298 (patch)
tree354f1cfbd58cd6e53d9ec28e8a30c9e2f2f79510
parent64afa20360bbd4a086305282c2a82e42614a615c (diff)
downloadgitlab-ci-5d14d52507352a4a0cb614f948dabbd85cc68298.tar.gz
fix list of branches in only section
-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 4711964..2edeb8c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,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