summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/build/rules/rule/clause/changes.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-20 15:40:28 +0000
commitb595cb0c1dec83de5bdee18284abe86614bed33b (patch)
tree8c3d4540f193c5ff98019352f554e921b3a41a72 /lib/gitlab/ci/build/rules/rule/clause/changes.rb
parent2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff)
downloadgitlab-ce-b595cb0c1dec83de5bdee18284abe86614bed33b.tar.gz
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'lib/gitlab/ci/build/rules/rule/clause/changes.rb')
-rw-r--r--lib/gitlab/ci/build/rules/rule/clause/changes.rb20
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/gitlab/ci/build/rules/rule/clause/changes.rb b/lib/gitlab/ci/build/rules/rule/clause/changes.rb
index 4c5f02b4f7b..1bcd87c9d93 100644
--- a/lib/gitlab/ci/build/rules/rule/clause/changes.rb
+++ b/lib/gitlab/ci/build/rules/rule/clause/changes.rb
@@ -4,8 +4,10 @@ module Gitlab
module Ci
module Build
class Rules::Rule::Clause::Changes < Rules::Rule::Clause
+ include Gitlab::Utils::StrongMemoize
+
def initialize(globs)
- @globs = Array(globs)
+ @globs = globs
end
def satisfied_by?(pipeline, context)
@@ -19,13 +21,25 @@ module Gitlab
end
end
+ private
+
def expand_globs(context)
- return @globs unless context
+ return paths unless context
- @globs.map do |glob|
+ paths.map do |glob|
ExpandVariables.expand_existing(glob, -> { context.variables_hash })
end
end
+
+ def paths
+ strong_memoize(:paths) do
+ if @globs.is_a?(Array)
+ @globs
+ else
+ Array(@globs[:paths])
+ end
+ end
+ end
end
end
end