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
Jérome Perrin
gitlab-ce
Commits
31b8287a
Commit
31b8287a
authored
Apr 05, 2017
by
Mike Wyatt
Committed by
Rémy Coutable
Apr 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return an empty array when dependencies is an empty array
parent
10a77824
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
app/models/ci/build.rb
app/models/ci/build.rb
+6
-0
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+23
-0
No files found.
app/models/ci/build.rb
View file @
31b8287a
...
@@ -540,6 +540,8 @@ module Ci
...
@@ -540,6 +540,8 @@ module Ci
end
end
def
dependencies
def
dependencies
return
[]
if
empty_dependencies?
depended_jobs
=
depends_on_builds
depended_jobs
=
depends_on_builds
return
depended_jobs
unless
options
[
:dependencies
].
present?
return
depended_jobs
unless
options
[
:dependencies
].
present?
...
@@ -549,6 +551,10 @@ module Ci
...
@@ -549,6 +551,10 @@ module Ci
end
end
end
end
def
empty_dependencies?
options
[
:dependencies
]
&
.
empty?
end
private
private
def
update_artifacts_size
def
update_artifacts_size
...
...
spec/requests/api/runner_spec.rb
View file @
31b8287a
...
@@ -461,6 +461,29 @@ describe API::Runner do
...
@@ -461,6 +461,29 @@ describe API::Runner do
end
end
end
end
context
'when dependencies is an empty array'
do
let!
(
:job
)
{
create
(
:ci_build_tag
,
pipeline:
pipeline
,
name:
'spinach'
,
stage:
'test'
,
stage_idx:
0
)
}
let!
(
:job2
)
{
create
(
:ci_build_tag
,
pipeline:
pipeline
,
name:
'rubocop'
,
stage:
'test'
,
stage_idx:
0
)
}
let!
(
:empty_dependencies_job
)
do
create
(
:ci_build
,
pipeline:
pipeline
,
token:
'test-job-token'
,
name:
'empty_dependencies_job'
,
stage:
'deploy'
,
stage_idx:
1
,
options:
{
dependencies:
[]
})
end
before
do
job
.
success
job2
.
success
end
it
'returns an empty array'
do
request_job
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
'id'
]).
to
eq
(
empty_dependencies_job
.
id
)
expect
(
json_response
[
'dependencies'
].
count
).
to
eq
(
0
)
end
end
context
'when job has no tags'
do
context
'when job has no tags'
do
before
{
job
.
update
(
tags:
[])
}
before
{
job
.
update
(
tags:
[])
}
...
...
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