summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-12-07 23:38:09 +0900
committerKamil TrzciƄski <ayufan@ayufan.eu>2018-12-11 12:03:47 +0100
commiteb1956c504f876263bcb3cbea2ddb43598e8a20d (patch)
tree8edf540139fd74a84b5d97b3ad3ca29d7f32c1cd /lib
parent85f430cb3cde4ff8c4d24c1b2a426670e38dd44f (diff)
downloadgitlab-ce-eb1956c504f876263bcb3cbea2ddb43598e8a20d.tar.gz
Fix MR pipelines run on only: refex
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ci/build/policy/refs.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/gitlab/ci/build/policy/refs.rb b/lib/gitlab/ci/build/policy/refs.rb
index 10934536536..0e9bb5c94bb 100644
--- a/lib/gitlab/ci/build/policy/refs.rb
+++ b/lib/gitlab/ci/build/policy/refs.rb
@@ -32,10 +32,14 @@ module Gitlab
return true if pipeline.source == pattern
return true if pipeline.source&.pluralize == pattern
- if pattern.first == "/" && pattern.last == "/"
- Regexp.new(pattern[1...-1]) =~ pipeline.ref
- else
- pattern == pipeline.ref
+ # patterns can be matched only when branch or tag is used
+ # the pattern matching does not work for merge requests pipelines
+ if pipeline.branch? || pipeline.tag?
+ if pattern.first == "/" && pattern.last == "/"
+ Regexp.new(pattern[1...-1]) =~ pipeline.ref
+ else
+ pattern == pipeline.ref
+ end
end
end
end