Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
1bf9e347
Commit
1bf9e347
authored
Jul 18, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move except and only job nodes to new CI config
parent
27e88efc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
3 deletions
+93
-3
lib/gitlab/ci/config/node/job.rb
lib/gitlab/ci/config/node/job.rb
+9
-1
lib/gitlab/ci/config/node/while.rb
lib/gitlab/ci/config/node/while.rb
+26
-0
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+2
-2
spec/lib/gitlab/ci/config/node/while_spec.rb
spec/lib/gitlab/ci/config/node/while_spec.rb
+56
-0
No files found.
lib/gitlab/ci/config/node/job.rb
View file @
1bf9e347
...
...
@@ -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
...
...
lib/gitlab/ci/config/node/while.rb
0 → 100644
View file @
1bf9e347
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
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
1bf9e347
...
...
@@ -163,7 +163,7 @@ module Ci
shared_examples
'raises an error'
do
it
do
expect
{
processor
}.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
'
rspec job: only parameter
should be an array of strings or regexps'
)
expect
{
processor
}.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
'
jobs:rspec:only config
should be an array of strings or regexps'
)
end
end
...
...
@@ -319,7 +319,7 @@ module Ci
shared_examples
'raises an error'
do
it
do
expect
{
processor
}.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
'
rspec job: except parameter
should be an array of strings or regexps'
)
expect
{
processor
}.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
'
jobs:rspec:except config
should be an array of strings or regexps'
)
end
end
...
...
spec/lib/gitlab/ci/config/node/while_spec.rb
0 → 100644
View file @
1bf9e347
require
'spec_helper'
describe
Gitlab
::
Ci
::
Config
::
Node
::
While
do
let
(
:entry
)
{
described_class
.
new
(
config
)
}
describe
'validations'
do
context
'when entry config value is valid'
do
context
'when config is a branch or tag name'
do
let
(
:config
)
{
%w[master feature/branch]
}
describe
'#valid?'
do
it
'is valid'
do
expect
(
entry
).
to
be_valid
end
end
describe
'#value'
do
it
'returns key value'
do
expect
(
entry
.
value
).
to
eq
config
end
end
end
context
'when config is a regexp'
do
let
(
:config
)
{
[
'/^issue-.*$/'
]
}
describe
'#valid?'
do
it
'is valid'
do
expect
(
entry
).
to
be_valid
end
end
end
context
'when config is a special keyword'
do
let
(
:config
)
{
%w[tags triggers branches]
}
describe
'#valid?'
do
it
'is valid'
do
expect
(
entry
).
to
be_valid
end
end
end
end
context
'when entry value is not valid'
do
let
(
:config
)
{
[
1
]
}
describe
'#errors'
do
it
'saves errors'
do
expect
(
entry
.
errors
)
.
to
include
'while config should be an array of strings or regexps'
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment