Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-12-11 15:43:54 +0300
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2018-12-14 15:03:59 +0300
commitfc2ec3b5b6b5bf07ff911f62641144fdb9bf334a (patch)
tree7635102502840038fea0e22e617672b697ea0578 /lib
parent8f4ec2509d9fd6f824cfd0a3ace90088df0153ed (diff)
Merge branch 'fix-mr-pipelines-run-on-regex' into 'master'
Fix MR pipelines run on only: regexp Closes #55026 See merge request gitlab-org/gitlab-ce!23657 (cherry picked from commit 7e4fcfb04c70604a8d9c2fade167bb04fc8f1d28) eb1956c5 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