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
Léo-Paul Géneau
gitlab-ce
Commits
943ae747
Commit
943ae747
authored
Jul 18, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move tags and allow_failure CI entries to new config
parent
6d466733
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+0
-8
lib/gitlab/ci/config/node/job.rb
lib/gitlab/ci/config/node/job.rb
+8
-0
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+2
-2
No files found.
lib/ci/gitlab_ci_yaml_processor.rb
View file @
943ae747
...
...
@@ -99,14 +99,6 @@ module Ci
end
def
validate_job_types!
(
name
,
job
)
if
job
[
:tags
]
&&
!
validate_array_of_strings
(
job
[
:tags
])
raise
ValidationError
,
"
#{
name
}
job: tags parameter should be an array of strings"
end
if
job
[
:allow_failure
]
&&
!
validate_boolean
(
job
[
:allow_failure
])
raise
ValidationError
,
"
#{
name
}
job: allow_failure parameter should be an boolean"
end
if
job
[
:when
]
&&
!
job
[
:when
].
in?
(
%w[on_success on_failure always]
)
raise
ValidationError
,
"
#{
name
}
job: when parameter should be on_success, on_failure or always"
end
...
...
lib/gitlab/ci/config/node/job.rb
View file @
943ae747
...
...
@@ -7,6 +7,9 @@ module Gitlab
#
class
Job
<
Entry
include
Configurable
include
Attributable
attributes
:tags
,
:allow_failure
validations
do
validates
:config
,
allowed_keys:
...
...
@@ -17,6 +20,11 @@ module Gitlab
validates
:config
,
presence:
true
validates
:name
,
presence:
true
validates
:name
,
type:
Symbol
with_options
allow_nil:
true
do
validates
:tags
,
array_of_strings:
true
validates
:allow_failure
,
boolean:
true
end
end
node
:before_script
,
Script
,
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
943ae747
...
...
@@ -956,7 +956,7 @@ EOT
config
=
YAML
.
dump
({
rspec:
{
script:
"test"
,
tags:
"mysql"
}
})
expect
do
GitlabCiYamlProcessor
.
new
(
config
,
path
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
rspec job: tags parameter
should be an array of strings"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
jobs:rspec tags
should be an array of strings"
)
end
it
"returns errors if before_script parameter is invalid"
do
...
...
@@ -1075,7 +1075,7 @@ EOT
config
=
YAML
.
dump
({
rspec:
{
script:
"test"
,
allow_failure:
"string"
}
})
expect
do
GitlabCiYamlProcessor
.
new
(
config
,
path
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
rspec job: allow_failure parameter should be an boolean
"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
jobs:rspec allow failure should be a boolean value
"
)
end
it
"returns errors if job stage is not a string"
do
...
...
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