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
Léo-Paul Géneau
gitlab-ce
Commits
f696b04c
Commit
f696b04c
authored
Aug 13, 2017
by
Mehdi Lahmam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose last pipeline details in API response when getting a single commit
Closes #35692.
parent
178ae69b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
2 deletions
+42
-2
changelogs/unreleased/expose-last-pipeline-details-in-api-for-single-commit.yml
...expose-last-pipeline-details-in-api-for-single-commit.yml
+5
-0
doc/api/commits.md
doc/api/commits.md
+6
-0
lib/api/entities.rb
lib/api/entities.rb
+1
-0
spec/fixtures/api/schemas/public_api/v4/commit/detail.json
spec/fixtures/api/schemas/public_api/v4/commit/detail.json
+9
-2
spec/fixtures/api/schemas/public_api/v4/pipeline/basic.json
spec/fixtures/api/schemas/public_api/v4/pipeline/basic.json
+16
-0
spec/requests/api/commits_spec.rb
spec/requests/api/commits_spec.rb
+5
-0
No files found.
changelogs/unreleased/expose-last-pipeline-details-in-api-for-single-commit.yml
0 → 100644
View file @
f696b04c
---
title
:
Expose last pipeline details in API response when getting a single commit
merge_request
:
13521
author
:
Mehdi Lahmam (@mehlah)
type
:
added
doc/api/commits.md
View file @
f696b04c
...
@@ -181,6 +181,12 @@ Example response:
...
@@ -181,6 +181,12 @@ Example response:
"parent_ids"
:
[
"parent_ids"
:
[
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
],
],
"last_pipeline"
:
{
"id"
:
8
,
"ref"
:
"master"
,
"sha"
:
"2dc6aa325a317eda67812f05600bdf0fcdc70ab0"
"status"
:
"created"
}
"stats"
:
{
"stats"
:
{
"additions"
:
15
,
"additions"
:
15
,
"deletions"
:
10
,
"deletions"
:
10
,
...
...
lib/api/entities.rb
View file @
f696b04c
...
@@ -234,6 +234,7 @@ module API
...
@@ -234,6 +234,7 @@ module API
class
RepoCommitDetail
<
RepoCommit
class
RepoCommitDetail
<
RepoCommit
expose
:stats
,
using:
Entities
::
RepoCommitStats
expose
:stats
,
using:
Entities
::
RepoCommitStats
expose
:status
expose
:status
expose
:last_pipeline
,
using:
'API::Entities::PipelineBasic'
end
end
class
RepoBranch
<
Grape
::
Entity
class
RepoBranch
<
Grape
::
Entity
...
...
spec/fixtures/api/schemas/public_api/v4/commit/detail.json
View file @
f696b04c
...
@@ -5,11 +5,18 @@
...
@@ -5,11 +5,18 @@
{
{
"required"
:
[
"required"
:
[
"stats"
,
"stats"
,
"status"
"status"
,
"last_pipeline"
],
],
"properties"
:
{
"properties"
:
{
"stats"
:
{
"$ref"
:
"../commit_stats.json"
},
"stats"
:
{
"$ref"
:
"../commit_stats.json"
},
"status"
:
{
"type"
:
[
"string"
,
"null"
]
}
"status"
:
{
"type"
:
[
"string"
,
"null"
]
},
"last_pipeline"
:
{
"oneOf"
:
[
{
"type"
:
"null"
},
{
"$ref"
:
"../pipeline/basic.json"
}
]
}
}
}
}
}
]
]
...
...
spec/fixtures/api/schemas/public_api/v4/pipeline/basic.json
0 → 100644
View file @
f696b04c
{
"type"
:
"object"
,
"required"
:
[
"id"
,
"sha"
,
"ref"
,
"status"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"sha"
:
{
"type"
:
"string"
},
"ref"
:
{
"type"
:
"string"
},
"status"
:
{
"type"
:
"string"
}
},
"additionalProperties"
:
false
}
spec/requests/api/commits_spec.rb
View file @
f696b04c
...
@@ -491,6 +491,7 @@ describe API::Commits do
...
@@ -491,6 +491,7 @@ describe API::Commits do
expect
(
json_response
[
'stats'
][
'deletions'
]).
to
eq
(
commit
.
stats
.
deletions
)
expect
(
json_response
[
'stats'
][
'deletions'
]).
to
eq
(
commit
.
stats
.
deletions
)
expect
(
json_response
[
'stats'
][
'total'
]).
to
eq
(
commit
.
stats
.
total
)
expect
(
json_response
[
'stats'
][
'total'
]).
to
eq
(
commit
.
stats
.
total
)
expect
(
json_response
[
'status'
]).
to
be_nil
expect
(
json_response
[
'status'
]).
to
be_nil
expect
(
json_response
[
'last_pipeline'
]).
to
be_nil
end
end
context
'when ref does not exist'
do
context
'when ref does not exist'
do
...
@@ -573,6 +574,10 @@ describe API::Commits do
...
@@ -573,6 +574,10 @@ describe API::Commits do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/commit/detail'
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/commit/detail'
)
expect
(
json_response
[
'status'
]).
to
eq
(
'created'
)
expect
(
json_response
[
'status'
]).
to
eq
(
'created'
)
expect
(
json_response
[
'last_pipeline'
][
'id'
]).
to
eq
(
pipeline
.
id
)
expect
(
json_response
[
'last_pipeline'
][
'ref'
]).
to
eq
(
pipeline
.
ref
)
expect
(
json_response
[
'last_pipeline'
][
'sha'
]).
to
eq
(
pipeline
.
sha
)
expect
(
json_response
[
'last_pipeline'
][
'status'
]).
to
eq
(
pipeline
.
status
)
end
end
context
'when pipeline succeeds'
do
context
'when pipeline succeeds'
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