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:
authorKamil Trzciński <ayufan@ayufan.eu>2019-03-01 18:37:14 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2019-03-01 18:37:14 +0300
commite6f6845d64f5e4be1e222124ae8d5e5f4e623530 (patch)
treea4e73a7e722cf1c56e87291ea47ee8c8770c8af4 /lib
parentb3b5544a4abac853ab915a3c88b9901e36633fbd (diff)
parentf62dc67d262792829bdcaef779b3915e9cc93a4f (diff)
Merge branch 'refactor-merge-request-between-pipeline-and-build' into 'master'
Add suffix (`_event`) to merge request source Closes gitlab-ee#9893 See merge request gitlab-org/gitlab-ce!25508
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ci/build/policy/refs.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/ci/build/policy/refs.rb b/lib/gitlab/ci/build/policy/refs.rb
index 0e9bb5c94bb..df5f5ffc253 100644
--- a/lib/gitlab/ci/build/policy/refs.rb
+++ b/lib/gitlab/ci/build/policy/refs.rb
@@ -29,8 +29,8 @@ module Gitlab
def matches_pattern?(pattern, pipeline)
return true if pipeline.tag? && pattern == 'tags'
return true if pipeline.branch? && pattern == 'branches'
- return true if pipeline.source == pattern
- return true if pipeline.source&.pluralize == pattern
+ return true if sanitized_source_name(pipeline) == pattern
+ return true if sanitized_source_name(pipeline)&.pluralize == pattern
# patterns can be matched only when branch or tag is used
# the pattern matching does not work for merge requests pipelines
@@ -42,6 +42,10 @@ module Gitlab
end
end
end
+
+ def sanitized_source_name(pipeline)
+ @sanitized_source_name ||= pipeline&.source&.delete_suffix('_event')
+ end
end
end
end