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
Boxiang Sun
gitlab-ce
Commits
27e88efc
Commit
27e88efc
authored
Jul 18, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move job image and services nodes to new CI config
parent
bbda0586
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
13 deletions
+14
-13
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
+10
-1
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+4
-4
No files found.
lib/ci/gitlab_ci_yaml_processor.rb
View file @
27e88efc
...
@@ -120,14 +120,6 @@ module Ci
...
@@ -120,14 +120,6 @@ module Ci
end
end
def
validate_job_types!
(
name
,
job
)
def
validate_job_types!
(
name
,
job
)
if
job
[
:image
]
&&
!
validate_string
(
job
[
:image
])
raise
ValidationError
,
"
#{
name
}
job: image should be a string"
end
if
job
[
:services
]
&&
!
validate_array_of_strings
(
job
[
:services
])
raise
ValidationError
,
"
#{
name
}
job: services should be an array of strings"
end
if
job
[
:tags
]
&&
!
validate_array_of_strings
(
job
[
:tags
])
if
job
[
:tags
]
&&
!
validate_array_of_strings
(
job
[
:tags
])
raise
ValidationError
,
"
#{
name
}
job: tags parameter should be an array of strings"
raise
ValidationError
,
"
#{
name
}
job: tags parameter should be an array of strings"
end
end
...
...
lib/gitlab/ci/config/node/job.rb
View file @
27e88efc
...
@@ -32,7 +32,14 @@ module Gitlab
...
@@ -32,7 +32,14 @@ module Gitlab
node
:cache
,
Cache
,
node
:cache
,
Cache
,
description:
'Cache definition for this job.'
description:
'Cache definition for this job.'
helpers
:before_script
,
:script
,
:stage
,
:type
,
:after_script
,
:cache
node
:image
,
Image
,
description:
'Image that will be used to execute this job.'
node
:services
,
Services
,
description:
'Services that will be used to execute this job.'
helpers
:before_script
,
:script
,
:stage
,
:type
,
:after_script
,
:cache
,
:image
,
:services
def
name
def
name
@metadata
[
:name
]
@metadata
[
:name
]
...
@@ -48,6 +55,8 @@ module Gitlab
...
@@ -48,6 +55,8 @@ module Gitlab
{
name:
name
,
{
name:
name
,
before_script:
before_script
,
before_script:
before_script
,
script:
script
,
script:
script
,
image:
image
,
services:
services
,
stage:
stage
,
stage:
stage
,
cache:
cache
,
cache:
cache
,
after_script:
after_script
}
after_script:
after_script
}
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
27e88efc
...
@@ -1012,7 +1012,7 @@ EOT
...
@@ -1012,7 +1012,7 @@ EOT
config
=
YAML
.
dump
({
rspec:
{
script:
"test"
,
image:
[
"test"
]
}
})
config
=
YAML
.
dump
({
rspec:
{
script:
"test"
,
image:
[
"test"
]
}
})
expect
do
expect
do
GitlabCiYamlProcessor
.
new
(
config
,
path
)
GitlabCiYamlProcessor
.
new
(
config
,
path
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
rspec job: image
should be a string"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
jobs:rspec:image config
should be a string"
)
end
end
it
"returns errors if services parameter is not an array"
do
it
"returns errors if services parameter is not an array"
do
...
@@ -1033,14 +1033,14 @@ EOT
...
@@ -1033,14 +1033,14 @@ EOT
config
=
YAML
.
dump
({
rspec:
{
script:
"test"
,
services:
"test"
}
})
config
=
YAML
.
dump
({
rspec:
{
script:
"test"
,
services:
"test"
}
})
expect
do
expect
do
GitlabCiYamlProcessor
.
new
(
config
,
path
)
GitlabCiYamlProcessor
.
new
(
config
,
path
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
rspec job: services
should be an array of strings"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
jobs:rspec:services config
should be an array of strings"
)
end
end
it
"returns errors if job services parameter is not an array of strings"
do
it
"returns errors if job services parameter is not an array of strings"
do
config
=
YAML
.
dump
({
rspec:
{
script:
"test"
,
services:
[
10
,
"test"
]
}
})
config
=
YAML
.
dump
({
rspec:
{
script:
"test"
,
services:
[
10
,
"test"
]
}
})
expect
do
expect
do
GitlabCiYamlProcessor
.
new
(
config
,
path
)
GitlabCiYamlProcessor
.
new
(
config
,
path
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
rspec job: services
should be an array of strings"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
jobs:rspec:services config
should be an array of strings"
)
end
end
it
"returns error if job configuration is invalid"
do
it
"returns error if job configuration is invalid"
do
...
@@ -1054,7 +1054,7 @@ EOT
...
@@ -1054,7 +1054,7 @@ EOT
config
=
YAML
.
dump
({
extra:
{
services:
"test"
}
})
config
=
YAML
.
dump
({
extra:
{
services:
"test"
}
})
expect
do
expect
do
GitlabCiYamlProcessor
.
new
(
config
,
path
)
GitlabCiYamlProcessor
.
new
(
config
,
path
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
Unknown parameter: extra
"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
jobs:extra:services config should be an array of strings
"
)
end
end
it
"returns errors if there are no jobs defined"
do
it
"returns errors if there are no jobs defined"
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