Commit 75225239 authored by Furkan Ayhan's avatar Furkan Ayhan Committed by Vitali Tatarintev

Refactor build/bridge codes by using processable

Here, we are moving same codes into processable
parent 3510277d
......@@ -18,7 +18,6 @@ module Gitlab
validates :config, allowed_keys: ALLOWED_KEYS + PROCESSABLE_ALLOWED_KEYS
with_options allow_nil: true do
validates :allow_failure, boolean: true
validates :when, inclusion: {
in: ALLOWED_WHEN,
message: "should be one of: #{ALLOWED_WHEN.join(', ')}"
......@@ -48,7 +47,7 @@ module Gitlab
inherit: false,
metadata: { allowed_needs: %i[job bridge] }
attributes :when, :allow_failure
attributes :when
def self.matching?(name, config)
!name.to_s.start_with?('.') &&
......@@ -60,14 +59,6 @@ module Gitlab
true
end
def manual_action?
self.when == 'manual'
end
def ignored?
allow_failure.nil? ? manual_action? : allow_failure
end
def value
super.merge(
trigger: (trigger_value if trigger_defined?),
......
......@@ -24,7 +24,6 @@ module Gitlab
validates :script, presence: true
with_options allow_nil: true do
validates :allow_failure, boolean: true
validates :when, inclusion: {
in: ALLOWED_WHEN,
message: "should be one of: #{ALLOWED_WHEN.join(', ')}"
......@@ -118,7 +117,7 @@ module Gitlab
description: 'Parallel configuration for this job.',
inherit: false
attributes :script, :tags, :allow_failure, :when, :dependencies,
attributes :script, :tags, :when, :dependencies,
:needs, :retry, :parallel, :start_in,
:interruptible, :timeout, :resource_group, :release
......@@ -141,18 +140,10 @@ module Gitlab
end
end
def manual_action?
self.when == 'manual'
end
def delayed?
self.when == 'delayed'
end
def ignored?
allow_failure.nil? ? manual_action? : allow_failure
end
def value
super.merge(
before_script: before_script_value,
......
......@@ -32,6 +32,7 @@ module Gitlab
with_options allow_nil: true do
validates :extends, array_of_strings_or_string: true
validates :rules, array_of_hashes: true
validates :allow_failure, boolean: true
end
end
......@@ -64,7 +65,7 @@ module Gitlab
inherit: false,
default: {}
attributes :extends, :rules
attributes :extends, :rules, :allow_failure
end
def compose!(deps = nil)
......@@ -136,6 +137,14 @@ module Gitlab
root_variables.merge(variables_value.to_h)
end
def manual_action?
self.when == 'manual'
end
def ignored?
allow_failure.nil? ? manual_action? : allow_failure
end
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment