summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/config/entry/job.rb
diff options
context:
space:
mode:
authorKamil TrzciƄski <ayufan@ayufan.eu>2018-12-13 10:39:55 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-12-13 10:39:55 +0000
commit0165cfaa078a50f52c9f24e1c468b77b509c89f3 (patch)
tree0d1ab70049703c76440281aba201f3a6d2d81d52 /lib/gitlab/ci/config/entry/job.rb
parent6b68d82fbf2da3f73d411e7a6fbda16cd3b94604 (diff)
downloadgitlab-ce-0165cfaa078a50f52c9f24e1c468b77b509c89f3.tar.gz
Re-define default only except policy
Diffstat (limited to 'lib/gitlab/ci/config/entry/job.rb')
-rw-r--r--lib/gitlab/ci/config/entry/job.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb
index 085be5da08d..50942fbdb40 100644
--- a/lib/gitlab/ci/config/entry/job.rb
+++ b/lib/gitlab/ci/config/entry/job.rb
@@ -16,6 +16,13 @@ module Gitlab
dependencies before_script after_script variables
environment coverage retry parallel extends].freeze
+ DEFAULT_ONLY_POLICY = {
+ refs: %w(branches tags)
+ }.freeze
+
+ DEFAULT_EXCEPT_POLICY = {
+ }.freeze
+
validations do
validates :config, allowed_keys: ALLOWED_KEYS
validates :config, presence: true
@@ -65,10 +72,10 @@ module Gitlab
entry :services, Entry::Services,
description: 'Services that will be used to execute this job.'
- entry :only, Entry::OnlyPolicy,
+ entry :only, Entry::Policy,
description: 'Refs policy this job will be executed for.'
- entry :except, Entry::ExceptPolicy,
+ entry :except, Entry::Policy,
description: 'Refs policy this job will be executed for.'
entry :variables, Entry::Variables,
@@ -154,8 +161,8 @@ module Gitlab
services: services_value,
stage: stage_value,
cache: cache_value,
- only: only_value,
- except: except_value,
+ only: DEFAULT_ONLY_POLICY.deep_merge(only_value.to_h),
+ except: DEFAULT_EXCEPT_POLICY.deep_merge(except_value.to_h),
variables: variables_defined? ? variables_value : nil,
environment: environment_defined? ? environment_value : nil,
environment_name: environment_defined? ? environment_value[:name] : nil,