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.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/gitlab/ci/config/entry/rules/rule.rb b/lib/gitlab/ci/config/entry/rules/rule.rb
index 63bf1b38ac6..1e7f6056a65 100644
--- a/lib/gitlab/ci/config/entry/rules/rule.rb
+++ b/lib/gitlab/ci/config/entry/rules/rule.rb
@@ -9,7 +9,7 @@ module Gitlab
include ::Gitlab::Config::Entry::Configurable
include ::Gitlab::Config::Entry::Attributable
- ALLOWED_KEYS = %i[if changes exists when start_in allow_failure variables].freeze
+ ALLOWED_KEYS = %i[if changes exists when start_in allow_failure variables needs].freeze
ALLOWED_WHEN = %w[on_success on_failure always never manual delayed].freeze
attributes :if, :exists, :when, :start_in, :allow_failure
@@ -20,6 +20,11 @@ module Gitlab
entry :variables, Entry::Variables,
description: 'Environment variables to define for rule conditions.'
+ entry :needs, Entry::Needs,
+ description: 'Needs configuration to define for rule conditions.',
+ metadata: { allowed_needs: %i[job] },
+ inherit: false
+
validations do
validates :config, presence: true
validates :config, type: { with: Hash }
@@ -46,7 +51,8 @@ module Gitlab
def value
config.merge(
changes: (changes_value if changes_defined?),
- variables: (variables_value if variables_defined?)
+ variables: (variables_value if variables_defined?),
+ needs: (needs_value if needs_defined?)
).compact
end