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/ci
diff options
context:
space:
mode:
authorFilip Krakowski <Filip.Krakowski@Uni-Duesseldorf.de>2017-06-02 20:02:56 +0300
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-06-07 18:34:58 +0300
commitecb54cddd164fbf83288d7903c4692df462bae5e (patch)
tree992908751c781851a8c8b63194132b3b2d59e6f7 /lib/ci
parent8db63b26284d949000316a38676ef6fad970f657 (diff)
Add all sources as special keywords for only and except
Diffstat (limited to 'lib/ci')
-rw-r--r--lib/ci/gitlab_ci_yaml_processor.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb
index 98600a48d0f..0b362921b06 100644
--- a/lib/ci/gitlab_ci_yaml_processor.rb
+++ b/lib/ci/gitlab_ci_yaml_processor.rb
@@ -207,17 +207,15 @@ module Ci
def matching?(patterns, ref, tag, source)
patterns.any? do |pattern|
- match_ref?(pattern, ref, tag, source)
+ match_ref?(pattern, ref, tag) || match_source?(pattern, source)
end
end
- def match_ref?(pattern, ref, tag, source)
+ def match_ref?(pattern, ref, tag)
pattern, path = pattern.split('@', 2)
return false if path && path != self.path
return true if tag && pattern == 'tags'
return true if !tag && pattern == 'branches'
- return true if source == 'trigger' && pattern == 'triggers'
- return true if source == 'schedule' && pattern == 'schedules'
if pattern.first == "/" && pattern.last == "/"
Regexp.new(pattern[1...-1]) =~ ref
@@ -225,5 +223,14 @@ module Ci
pattern == ref
end
end
+
+ def match_source?(pattern, source)
+ return source_to_pattern(source) == pattern
+ end
+
+ def source_to_pattern(source)
+ return source if ['api', 'external', 'web'].include? source
+ return source.pluralize
+ end
end
end