BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
b92d5135
Commit
b92d5135
authored
Jul 22, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix-old-ci-api' into 'master'
Fix support for old CI API when image or services are not specified Closes #35421 See merge request !13023
parents
d60b09d9
0711d9ad
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
1 deletion
+67
-1
entities.rb
lib/ci/api/entities.rb
+1
-1
builds_spec.rb
spec/requests/ci/api/builds_spec.rb
+66
-0
No files found.
lib/ci/api/entities.rb
View file @
b92d5135
...
...
@@ -52,7 +52,7 @@ module Ci
# when old API will be removed (planned for August 2017).
model
.
options
.
dup
.
tap
do
|
options
|
options
[
:image
]
=
options
[
:image
][
:name
]
if
options
[
:image
].
is_a?
(
Hash
)
options
[
:services
].
map!
do
|
service
|
options
[
:services
]
&
.
map!
do
|
service
|
if
service
.
is_a?
(
Hash
)
service
[
:name
]
else
...
...
spec/requests/ci/api/builds_spec.rb
View file @
b92d5135
...
...
@@ -69,6 +69,72 @@ describe Ci::API::Builds do
end
end
context
'when an old image syntax is used'
do
before
do
build
.
update!
(
options:
{
image:
'codeclimate'
})
end
it
'starts a build'
do
register_builds
info:
{
platform: :darwin
}
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
"options"
]).
to
eq
({
"image"
=>
"codeclimate"
})
end
end
context
'when a new image syntax is used'
do
before
do
build
.
update!
(
options:
{
image:
{
name:
'codeclimate'
}
})
end
it
'starts a build'
do
register_builds
info:
{
platform: :darwin
}
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
"options"
]).
to
eq
({
"image"
=>
"codeclimate"
})
end
end
context
'when an old service syntax is used'
do
before
do
build
.
update!
(
options:
{
services:
[
'mysql'
]
})
end
it
'starts a build'
do
register_builds
info:
{
platform: :darwin
}
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
"options"
]).
to
eq
({
"services"
=>
[
"mysql"
]
})
end
end
context
'when a new service syntax is used'
do
before
do
build
.
update!
(
options:
{
services:
[
name:
'mysql'
]
})
end
it
'starts a build'
do
register_builds
info:
{
platform: :darwin
}
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
"options"
]).
to
eq
({
"services"
=>
[
"mysql"
]
})
end
end
context
'when no image or service is defined'
do
before
do
build
.
update!
(
options:
{})
end
it
'starts a build'
do
register_builds
info:
{
platform: :darwin
}
expect
(
response
).
to
have_http_status
(
201
)
expect
(
json_response
[
"options"
]).
to
be_empty
end
end
context
'when there is a pending build'
do
it
'starts a build'
do
register_builds
info:
{
platform: :darwin
}
...
...
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