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
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/config/entry/rules/rule.rb')
-rw-r--r--lib/gitlab/ci/config/entry/rules/rule.rb21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/gitlab/ci/config/entry/rules/rule.rb b/lib/gitlab/ci/config/entry/rules/rule.rb
index 4722f2e9a61..63bf1b38ac6 100644
--- a/lib/gitlab/ci/config/entry/rules/rule.rb
+++ b/lib/gitlab/ci/config/entry/rules/rule.rb
@@ -9,11 +9,13 @@ module Gitlab
include ::Gitlab::Config::Entry::Configurable
include ::Gitlab::Config::Entry::Attributable
- CLAUSES = %i[if changes exists].freeze
- ALLOWED_KEYS = %i[if changes exists when start_in allow_failure variables].freeze
- ALLOWABLE_WHEN = %w[on_success on_failure always never manual delayed].freeze
+ ALLOWED_KEYS = %i[if changes exists when start_in allow_failure variables].freeze
+ ALLOWED_WHEN = %w[on_success on_failure always never manual delayed].freeze
- attributes :if, :changes, :exists, :when, :start_in, :allow_failure
+ attributes :if, :exists, :when, :start_in, :allow_failure
+
+ entry :changes, Entry::Rules::Rule::Changes,
+ description: 'File change condition rule.'
entry :variables, Entry::Variables,
description: 'Environment variables to define for rule conditions.'
@@ -28,8 +30,8 @@ module Gitlab
with_options allow_nil: true do
validates :if, expression: true
- validates :changes, :exists, array_of_strings: true, length: { maximum: 50 }
- validates :when, allowed_values: { in: ALLOWABLE_WHEN }
+ validates :exists, array_of_strings: true, length: { maximum: 50 }
+ validates :when, allowed_values: { in: ALLOWED_WHEN }
validates :allow_failure, boolean: true
end
@@ -41,6 +43,13 @@ module Gitlab
end
end
+ def value
+ config.merge(
+ changes: (changes_value if changes_defined?),
+ variables: (variables_value if variables_defined?)
+ ).compact
+ end
+
def specifies_delay?
self.when == 'delayed'
end