diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ci/ansi2json/parser.rb | 5 | ||||
-rw-r--r-- | lib/gitlab/ci/ansi2json/style.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/job.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/need.rb | 30 | ||||
-rw-r--r-- | lib/gitlab/ci/config/normalizer.rb | 2 |
5 files changed, 33 insertions, 10 deletions
diff --git a/lib/gitlab/ci/ansi2json/parser.rb b/lib/gitlab/ci/ansi2json/parser.rb index d428680fb2a..79b42a5f5bf 100644 --- a/lib/gitlab/ci/ansi2json/parser.rb +++ b/lib/gitlab/ci/ansi2json/parser.rb @@ -94,7 +94,7 @@ module Gitlab def on_38(stack) { fg: fg_color_256(stack) } end - def on_39(_) { fg: fg_color(9) } end + def on_39(_) { fg: nil } end def on_40(_) { bg: bg_color(0) } end @@ -114,8 +114,7 @@ module Gitlab def on_48(stack) { bg: bg_color_256(stack) } end - # TODO: all the x9 never get called? - def on_49(_) { fg: fg_color(9) } end + def on_49(_) { bg: nil } end def on_90(_) { fg: fg_color(0, 'l') } end diff --git a/lib/gitlab/ci/ansi2json/style.rb b/lib/gitlab/ci/ansi2json/style.rb index 77f61178b37..4d38ea55866 100644 --- a/lib/gitlab/ci/ansi2json/style.rb +++ b/lib/gitlab/ci/ansi2json/style.rb @@ -61,9 +61,9 @@ module Gitlab case when changes[:reset] reset! - when changes[:fg] + when changes.key?(:fg) @fg = changes[:fg] - when changes[:bg] + when changes.key?(:bg) @bg = changes[:bg] when changes[:enable] @mask |= changes[:enable] diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb index 7c01e6ffbe8..1aa2d6d0bcb 100644 --- a/lib/gitlab/ci/config/entry/job.rb +++ b/lib/gitlab/ci/config/entry/job.rb @@ -51,7 +51,7 @@ module Gitlab validates :rules, array_of_hashes: true end - validates :start_in, duration: { limit: '1 day' }, if: :delayed? + validates :start_in, duration: { limit: '1 week' }, if: :delayed? validates :start_in, absence: true, if: -> { has_rules? || !delayed? } validate do diff --git a/lib/gitlab/ci/config/entry/need.rb b/lib/gitlab/ci/config/entry/need.rb index b6db546d8ff..61bd09fd5f3 100644 --- a/lib/gitlab/ci/config/entry/need.rb +++ b/lib/gitlab/ci/config/entry/need.rb @@ -5,9 +5,10 @@ module Gitlab class Config module Entry class Need < ::Gitlab::Config::Entry::Simplifiable - strategy :Job, if: -> (config) { config.is_a?(String) } + strategy :JobString, if: -> (config) { config.is_a?(String) } + strategy :JobHash, if: -> (config) { config.is_a?(Hash) && config.key?(:job) } - class Job < ::Gitlab::Config::Entry::Node + class JobString < ::Gitlab::Config::Entry::Node include ::Gitlab::Config::Entry::Validatable validations do @@ -20,7 +21,30 @@ module Gitlab end def value - { name: @config } + { name: @config, artifacts: true } + end + end + + class JobHash < ::Gitlab::Config::Entry::Node + include ::Gitlab::Config::Entry::Validatable + include ::Gitlab::Config::Entry::Attributable + + ALLOWED_KEYS = %i[job artifacts].freeze + attributes :job, :artifacts + + validations do + validates :config, presence: true + validates :config, allowed_keys: ALLOWED_KEYS + validates :job, type: String, presence: true + validates :artifacts, boolean: true, allow_nil: true + end + + def type + :job + end + + def value + { name: job, artifacts: artifacts || artifacts.nil? } end end diff --git a/lib/gitlab/ci/config/normalizer.rb b/lib/gitlab/ci/config/normalizer.rb index e714ef225f5..1139efee9e8 100644 --- a/lib/gitlab/ci/config/normalizer.rb +++ b/lib/gitlab/ci/config/normalizer.rb @@ -44,7 +44,7 @@ module Gitlab if all_job_names = parallelized_jobs[job_need_name] all_job_names.map do |job_name| - { name: job_name } + job_need.merge(name: job_name) end else job_need |