diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-25 18:06:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-25 18:06:45 +0300 |
commit | ed9c54b56af280cc552aaac1cfa55533c900c1be (patch) | |
tree | 99605e6980c1673566fe7f293f9e4fe8dcdc4416 /lib/gitlab/ci | |
parent | 8f1f6b374b69fd6356bdc5561d56f5ca9db9fadd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci')
-rw-r--r-- | lib/gitlab/ci/config/entry/default.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/environment.rb | 15 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/job.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/kubernetes.rb | 25 |
4 files changed, 48 insertions, 8 deletions
diff --git a/lib/gitlab/ci/config/entry/default.rb b/lib/gitlab/ci/config/entry/default.rb index 646f06a60a9..b84ae53a514 100644 --- a/lib/gitlab/ci/config/entry/default.rb +++ b/lib/gitlab/ci/config/entry/default.rb @@ -15,7 +15,7 @@ module Gitlab ALLOWED_KEYS = %i[before_script image services after_script cache interruptible - timeout].freeze + timeout retry].freeze validations do validates :config, allowed_keys: ALLOWED_KEYS @@ -49,7 +49,11 @@ module Gitlab description: 'Set jobs default timeout.', inherit: false - helpers :before_script, :image, :services, :after_script, :cache, :interruptible, :timeout + entry :retry, Entry::Retry, + description: 'Set retry default value.', + inherit: false + + helpers :before_script, :image, :services, :after_script, :cache, :interruptible, :timeout, :retry private diff --git a/lib/gitlab/ci/config/entry/environment.rb b/lib/gitlab/ci/config/entry/environment.rb index 5a13fd18504..68254552f82 100644 --- a/lib/gitlab/ci/config/entry/environment.rb +++ b/lib/gitlab/ci/config/entry/environment.rb @@ -8,9 +8,11 @@ module Gitlab # Entry that represents an environment. # class Environment < ::Gitlab::Config::Entry::Node - include ::Gitlab::Config::Entry::Validatable + include ::Gitlab::Config::Entry::Configurable - ALLOWED_KEYS = %i[name url action on_stop].freeze + ALLOWED_KEYS = %i[name url action on_stop kubernetes].freeze + + entry :kubernetes, Entry::Kubernetes, description: 'Kubernetes deployment configuration.' validations do validate do @@ -46,6 +48,7 @@ module Gitlab allow_nil: true validates :on_stop, type: String, allow_nil: true + validates :kubernetes, type: Hash, allow_nil: true end end @@ -73,6 +76,10 @@ module Gitlab value[:on_stop] end + def kubernetes + value[:kubernetes] + end + def value case @config when String then { name: @config, action: 'start' } @@ -80,6 +87,10 @@ module Gitlab else {} end end + + def skip_config_hash_validation? + true + end end end end diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb index a109265f2a7..7c01e6ffbe8 100644 --- a/lib/gitlab/ci/config/entry/job.rb +++ b/lib/gitlab/ci/config/entry/job.rb @@ -105,6 +105,10 @@ module Gitlab description: 'Timeout duration of this job.', inherit: true + entry :retry, Entry::Retry, + description: 'Retry configuration for this job.', + inherit: true + entry :only, Entry::Policy, description: 'Refs policy this job will be executed for.', default: Entry::Policy::DEFAULT_ONLY, @@ -142,10 +146,6 @@ module Gitlab description: 'Coverage configuration for this job.', inherit: false - entry :retry, Entry::Retry, - description: 'Retry configuration for this job.', - inherit: false - helpers :before_script, :script, :stage, :type, :after_script, :cache, :image, :services, :only, :except, :variables, :artifacts, :environment, :coverage, :retry, :rules, diff --git a/lib/gitlab/ci/config/entry/kubernetes.rb b/lib/gitlab/ci/config/entry/kubernetes.rb new file mode 100644 index 00000000000..2f1595d4437 --- /dev/null +++ b/lib/gitlab/ci/config/entry/kubernetes.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Gitlab + module Ci + class Config + module Entry + class Kubernetes < ::Gitlab::Config::Entry::Node + include ::Gitlab::Config::Entry::Validatable + include ::Gitlab::Config::Entry::Attributable + + ALLOWED_KEYS = %i[namespace].freeze + + attributes ALLOWED_KEYS + + validations do + validates :config, type: Hash + validates :config, allowed_keys: ALLOWED_KEYS + + validates :namespace, type: String, presence: true + end + end + end + end + end +end |