summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-18 12:37:42 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-07-18 12:37:42 +0200
commit1bf9e34713b414f0e1ac8bbfe464a4cd5300581f (patch)
tree7bb7b1165563ad2515d41369ececf96a83b05f73 /lib
parent27e88efceb9d59affebf93be040b0a9b0bf31b2f (diff)
downloadgitlab-ce-1bf9e34713b414f0e1ac8bbfe464a4cd5300581f.tar.gz
Move except and only job nodes to new CI config
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ci/config/node/job.rb10
-rw-r--r--lib/gitlab/ci/config/node/while.rb26
2 files changed, 35 insertions, 1 deletions
diff --git a/lib/gitlab/ci/config/node/job.rb b/lib/gitlab/ci/config/node/job.rb
index 1c28969be14..401611def17 100644
--- a/lib/gitlab/ci/config/node/job.rb
+++ b/lib/gitlab/ci/config/node/job.rb
@@ -38,8 +38,14 @@ module Gitlab
node :services, Services,
description: 'Services that will be used to execute this job.'
+ node :only, While,
+ description: 'Refs policy this job will be executed for.'
+
+ node :except, While,
+ description: 'Refs policy this job will be executed for.'
+
helpers :before_script, :script, :stage, :type, :after_script,
- :cache, :image, :services
+ :cache, :image, :services, :only, :except
def name
@metadata[:name]
@@ -59,6 +65,8 @@ module Gitlab
services: services,
stage: stage,
cache: cache,
+ only: only,
+ except: except,
after_script: after_script }
end
diff --git a/lib/gitlab/ci/config/node/while.rb b/lib/gitlab/ci/config/node/while.rb
new file mode 100644
index 00000000000..84d4352624d
--- /dev/null
+++ b/lib/gitlab/ci/config/node/while.rb
@@ -0,0 +1,26 @@
+module Gitlab
+ module Ci
+ class Config
+ module Node
+ ##
+ # Entry that represents a ref and trigger policy for the job.
+ #
+ class While < Entry
+ include Validatable
+
+ validations do
+ include LegacyValidationHelpers
+
+ validate :array_of_strings_or_regexps
+
+ def array_of_strings_or_regexps
+ unless validate_array_of_strings_or_regexps(config)
+ errors.add(:config, 'should be an array of strings or regexps')
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end