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
1f324864
Commit
1f324864
authored
Apr 15, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make CI config return empty array if no job variables
parent
3dec6e26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
lib/ci/gitlab_ci_yaml_processor.rb
lib/ci/gitlab_ci_yaml_processor.rb
+5
-2
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
+12
-0
No files found.
lib/ci/gitlab_ci_yaml_processor.rb
View file @
1f324864
...
@@ -45,8 +45,11 @@ module Ci
...
@@ -45,8 +45,11 @@ module Ci
end
end
def
job_variables
(
name
)
def
job_variables
(
name
)
job
=
@jobs
[
name
.
to_sym
]
if
job
=
@jobs
[
name
.
to_sym
]
job
?
job
[
:variables
]
:
[]
job
[
:variables
]
||
[]
else
[]
end
end
end
private
private
...
...
spec/lib/ci/gitlab_ci_yaml_processor_spec.rb
View file @
1f324864
...
@@ -380,6 +380,18 @@ module Ci
...
@@ -380,6 +380,18 @@ module Ci
expect
(
config
.
job_variables
(
:rspec
)).
to
eq
job_variables
expect
(
config
.
job_variables
(
:rspec
)).
to
eq
job_variables
end
end
end
end
context
'when job variables are not defined'
do
it
'returns empty array'
do
config
=
YAML
.
dump
({
before_script:
[
"pwd"
],
rspec:
{
script:
"rspec"
}
})
config_processor
=
GitlabCiYamlProcessor
.
new
(
config
,
path
)
expect
(
config_processor
.
job_variables
(
:rspec
)).
to
eq
[]
end
end
end
end
describe
"When"
do
describe
"When"
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