summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config/external/mapper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/config/external/mapper.rb')
-rw-r--r--lib/gitlab/ci/config/external/mapper.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/gitlab/ci/config/external/mapper.rb b/lib/gitlab/ci/config/external/mapper.rb
index 3216d4eaac4..97e4922b2a1 100644
--- a/lib/gitlab/ci/config/external/mapper.rb
+++ b/lib/gitlab/ci/config/external/mapper.rb
@@ -33,6 +33,7 @@ module Gitlab
locations
.compact
.map(&method(:normalize_location))
+ .filter_map(&method(:verify_rules))
.flat_map(&method(:expand_project_files))
.flat_map(&method(:expand_wildcard_paths))
.map(&method(:expand_variables))
@@ -56,6 +57,15 @@ module Gitlab
end
end
+ def verify_rules(location)
+ # Behaves like there is no `rules`
+ return location unless ::Feature.enabled?(:ci_include_rules, context.project, default_enabled: :yaml)
+
+ return unless Rules.new(location[:rules]).evaluate(context).pass?
+
+ location
+ end
+
def expand_project_files(location)
return location unless location[:project]
@@ -65,8 +75,6 @@ module Gitlab
end
def expand_wildcard_paths(location)
- return location unless ::Feature.enabled?(:ci_wildcard_file_paths, context.project, default_enabled: :yaml)
-
# We only support local files for wildcard paths
return location unless location[:local] && location[:local].include?('*')