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
iv
gitlab-ce
Commits
1339fda1
Commit
1339fda1
authored
Apr 18, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor refactorings in CI config
parent
2972a991
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+7
-4
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+3
-3
No files found.
lib/ci/gitlab_ci_yaml_processor.rb
View file @
1339fda1
...
...
@@ -45,7 +45,10 @@ module Ci
end
def
job_variables
(
name
)
@jobs
[
name
.
to_sym
].
try
(
:fetch
,
:variables
,
[])
||
[]
job
=
@jobs
[
name
.
to_sym
]
return
[]
unless
job
job
.
fetch
(
:variables
,
[])
end
private
...
...
@@ -123,7 +126,7 @@ module Ci
end
unless
@variables
.
nil?
||
validate_variables
(
@variables
)
raise
ValidationError
,
"variables should be a map of key-value
d
strings"
raise
ValidationError
,
"variables should be a map of key-value strings"
end
if
@cache
...
...
@@ -216,9 +219,9 @@ module Ci
end
def
validate_job_variables!
(
name
,
job
)
if
job
[
:variables
]
&&
!
validate_variables
(
job
[
:variables
])
unless
validate_variables
(
job
[
:variables
])
raise
ValidationError
,
"
#{
name
}
job: variables should be a map of key-value
d
strings"
"
#{
name
}
job: variables should be a map of key-value strings"
end
end
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
1339fda1
...
...
@@ -786,14 +786,14 @@ EOT
config
=
YAML
.
dump
({
variables:
"test"
,
rspec:
{
script:
"test"
}
})
expect
do
GitlabCiYamlProcessor
.
new
(
config
,
path
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"variables should be a map of key-value
d
strings"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"variables should be a map of key-value strings"
)
end
it
"returns errors if variables is not a map of key-value
d
strings"
do
it
"returns errors if variables is not a map of key-value strings"
do
config
=
YAML
.
dump
({
variables:
{
test:
false
},
rspec:
{
script:
"test"
}
})
expect
do
GitlabCiYamlProcessor
.
new
(
config
,
path
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"variables should be a map of key-value
d
strings"
)
end
.
to
raise_error
(
GitlabCiYamlProcessor
::
ValidationError
,
"variables should be a map of key-value strings"
)
end
it
"returns errors if job when is not on_success, on_failure or always"
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