Class: Gitlab::Ci::Build::Rules::Rule::Clause::Exists
- Inherits:
-
Gitlab::Ci::Build::Rules::Rule::Clause
- Object
- Gitlab::Ci::Build::Rules::Rule::Clause
- Gitlab::Ci::Build::Rules::Rule::Clause::Exists
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/build/rules/rule/clause/exists.rb
Constant Summary collapse
- MAX_PATTERN_COMPARISONS =
The maximum number of patterned glob comparisons that will be performed before the rule assumes that it has a match
10_000
- WILDCARD_NESTED_PATTERN =
"**/*"
Constants inherited from Gitlab::Ci::Build::Rules::Rule::Clause
ParseError, UnknownClauseError
Instance Method Summary collapse
-
#initialize(clause) ⇒ Exists
constructor
A new instance of Exists.
- #satisfied_by?(_pipeline, context) ⇒ Boolean
Methods inherited from Gitlab::Ci::Build::Rules::Rule::Clause
Constructor Details
#initialize(clause) ⇒ Exists
Returns a new instance of Exists.
15 16 17 18 19 |
# File 'lib/gitlab/ci/build/rules/rule/clause/exists.rb', line 15 def initialize(clause) @globs = Array(clause[:paths]) @project_path = clause[:project] @ref = clause[:ref] end |
Instance Method Details
#satisfied_by?(_pipeline, context) ⇒ Boolean
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gitlab/ci/build/rules/rule/clause/exists.rb', line 21 def satisfied_by?(_pipeline, context) # Return early to avoid redundant Gitaly calls return false unless @globs.any? context = change_context(context) if @project_path = (context) top_level_only = .all?(&method(:top_level_glob?)) paths = worktree_paths(context, top_level_only) exact_globs, extension_globs, pattern_globs = separate_globs() exact_matches?(paths, exact_globs) || matches_extension?(paths, extension_globs) || pattern_matches?(paths, pattern_globs, context) end |