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
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
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
2 deletions
+42
-2
expose-last-pipeline-details-in-api-for-single-commit.yml
...expose-last-pipeline-details-in-api-for-single-commit.yml
+5
-0
commits.md
doc/api/commits.md
+6
-0
entities.rb
lib/api/entities.rb
+1
-0
detail.json
spec/fixtures/api/schemas/public_api/v4/commit/detail.json
+9
-2
basic.json
spec/fixtures/api/schemas/public_api/v4/pipeline/basic.json
+16
-0
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:
"parent_ids"
:
[
"ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
],
"last_pipeline"
:
{
"id"
:
8
,
"ref"
:
"master"
,
"sha"
:
"2dc6aa325a317eda67812f05600bdf0fcdc70ab0"
"status"
:
"created"
}
"stats"
:
{
"additions"
:
15
,
"deletions"
:
10
,
...
...
lib/api/entities.rb
View file @
f696b04c
...
...
@@ -234,6 +234,7 @@ module API
class
RepoCommitDetail
<
RepoCommit
expose
:stats
,
using:
Entities
::
RepoCommitStats
expose
:status
expose
:last_pipeline
,
using:
'API::Entities::PipelineBasic'
end
class
RepoBranch
<
Grape
::
Entity
...
...
spec/fixtures/api/schemas/public_api/v4/commit/detail.json
View file @
f696b04c
...
...
@@ -5,11 +5,18 @@
{
"required"
:
[
"stats"
,
"status"
"status"
,
"last_pipeline"
],
"properties"
:
{
"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
expect
(
json_response
[
'stats'
][
'deletions'
]).
to
eq
(
commit
.
stats
.
deletions
)
expect
(
json_response
[
'stats'
][
'total'
]).
to
eq
(
commit
.
stats
.
total
)
expect
(
json_response
[
'status'
]).
to
be_nil
expect
(
json_response
[
'last_pipeline'
]).
to
be_nil
end
context
'when ref does not exist'
do
...
...
@@ -573,6 +574,10 @@ describe API::Commits do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/commit/detail'
)
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
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