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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
dbab56a9
Commit
dbab56a9
authored
Jul 05, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create composite job entries in new CI config
parent
6ae80732
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
+33
-2
lib/gitlab/ci/config/node/jobs.rb
lib/gitlab/ci/config/node/jobs.rb
+14
-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/jobs_spec.rb
spec/lib/gitlab/ci/config/node/jobs_spec.rb
+17
-0
No files found.
lib/gitlab/ci/config/node/jobs.rb
View file @
dbab56a9
...
...
@@ -11,6 +11,20 @@ module Gitlab
validations
do
validates
:config
,
type:
Hash
end
def
nodes
@config
end
private
def
create_node
(
key
,
essence
)
Node
::
Job
.
new
(
essence
).
tap
do
|
job
|
job
.
key
=
key
job
.
parent
=
self
job
.
description
=
"
#{
key
}
job definition."
end
end
end
end
end
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
dbab56a9
...
...
@@ -1043,11 +1043,11 @@ EOT
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"rspec job: services should be an array of strings"
)
end
it
"returns error
s if there are unknown parameters
"
do
it
"returns error
if job configuration is invalid
"
do
config
=
YAML
.
dump
({
extra:
"bundle update"
})
expect
do
GitlabCiYamlProcessor
.
new
(
config
,
path
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
Unknown parameter: extra
"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"
jobs:extra config should be a hash
"
)
end
it
"returns errors if there are unknown parameters that are hashes, but doesn't have a script"
do
...
...
spec/lib/gitlab/ci/config/node/jobs_spec.rb
View file @
dbab56a9
...
...
@@ -4,6 +4,8 @@ describe Gitlab::Ci::Config::Node::Jobs do
let
(
:entry
)
{
described_class
.
new
(
config
)
}
describe
'validations'
do
before
{
entry
.
process!
}
context
'when entry config value is correct'
do
let
(
:config
)
{
{
rspec:
{
script:
'rspec'
}
}
}
...
...
@@ -33,4 +35,19 @@ describe Gitlab::Ci::Config::Node::Jobs do
end
end
end
describe
'#descendants'
do
before
{
entry
.
process!
}
let
(
:config
)
do
{
rspec:
{
script:
'rspec'
},
spinach:
{
script:
'spinach'
}
}
end
it
'creates two descendant nodes'
do
expect
(
entry
.
descendants
.
count
).
to
eq
2
expect
(
entry
.
descendants
)
.
to
all
(
be_an_instance_of
(
Gitlab
::
Ci
::
Config
::
Node
::
Job
))
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