Commit 739f0a51 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch '266975-refactoring-build-bridge' into 'master'

Refactor build/bridge codes by using processable

See merge request gitlab-org/gitlab!46762
parents 4987712a 75225239
...@@ -18,7 +18,6 @@ module Gitlab ...@@ -18,7 +18,6 @@ module Gitlab
validates :config, allowed_keys: ALLOWED_KEYS + PROCESSABLE_ALLOWED_KEYS validates :config, allowed_keys: ALLOWED_KEYS + PROCESSABLE_ALLOWED_KEYS
with_options allow_nil: true do with_options allow_nil: true do
validates :allow_failure, boolean: true
validates :when, inclusion: { validates :when, inclusion: {
in: ALLOWED_WHEN, in: ALLOWED_WHEN,
message: "should be one of: #{ALLOWED_WHEN.join(', ')}" message: "should be one of: #{ALLOWED_WHEN.join(', ')}"
...@@ -48,7 +47,7 @@ module Gitlab ...@@ -48,7 +47,7 @@ module Gitlab
inherit: false, inherit: false,
metadata: { allowed_needs: %i[job bridge] } metadata: { allowed_needs: %i[job bridge] }
attributes :when, :allow_failure attributes :when
def self.matching?(name, config) def self.matching?(name, config)
!name.to_s.start_with?('.') && !name.to_s.start_with?('.') &&
...@@ -60,14 +59,6 @@ module Gitlab ...@@ -60,14 +59,6 @@ module Gitlab
true true
end end
def manual_action?
self.when == 'manual'
end
def ignored?
allow_failure.nil? ? manual_action? : allow_failure
end
def value def value
super.merge( super.merge(
trigger: (trigger_value if trigger_defined?), trigger: (trigger_value if trigger_defined?),
......
...@@ -24,7 +24,6 @@ module Gitlab ...@@ -24,7 +24,6 @@ module Gitlab
validates :script, presence: true validates :script, presence: true
with_options allow_nil: true do with_options allow_nil: true do
validates :allow_failure, boolean: true
validates :when, inclusion: { validates :when, inclusion: {
in: ALLOWED_WHEN, in: ALLOWED_WHEN,
message: "should be one of: #{ALLOWED_WHEN.join(', ')}" message: "should be one of: #{ALLOWED_WHEN.join(', ')}"
...@@ -118,7 +117,7 @@ module Gitlab ...@@ -118,7 +117,7 @@ module Gitlab
description: 'Parallel configuration for this job.', description: 'Parallel configuration for this job.',
inherit: false inherit: false
attributes :script, :tags, :allow_failure, :when, :dependencies, attributes :script, :tags, :when, :dependencies,
:needs, :retry, :parallel, :start_in, :needs, :retry, :parallel, :start_in,
:interruptible, :timeout, :resource_group, :release :interruptible, :timeout, :resource_group, :release
...@@ -141,18 +140,10 @@ module Gitlab ...@@ -141,18 +140,10 @@ module Gitlab
end end
end end
def manual_action?
self.when == 'manual'
end
def delayed? def delayed?
self.when == 'delayed' self.when == 'delayed'
end end
def ignored?
allow_failure.nil? ? manual_action? : allow_failure
end
def value def value
super.merge( super.merge(
before_script: before_script_value, before_script: before_script_value,
......
...@@ -32,6 +32,7 @@ module Gitlab ...@@ -32,6 +32,7 @@ module Gitlab
with_options allow_nil: true do with_options allow_nil: true do
validates :extends, array_of_strings_or_string: true validates :extends, array_of_strings_or_string: true
validates :rules, array_of_hashes: true validates :rules, array_of_hashes: true
validates :allow_failure, boolean: true
end end
end end
...@@ -64,7 +65,7 @@ module Gitlab ...@@ -64,7 +65,7 @@ module Gitlab
inherit: false, inherit: false,
default: {} default: {}
attributes :extends, :rules attributes :extends, :rules, :allow_failure
end end
def compose!(deps = nil) def compose!(deps = nil)
...@@ -136,6 +137,14 @@ module Gitlab ...@@ -136,6 +137,14 @@ module Gitlab
root_variables.merge(variables_value.to_h) root_variables.merge(variables_value.to_h)
end end
def manual_action?
self.when == 'manual'
end
def ignored?
allow_failure.nil? ? manual_action? : allow_failure
end
end end
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