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
98522292
Commit
98522292
authored
Nov 22, 2019
by
Giorgenes Gelatti
Committed by
Peter Leitzen
Jan 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds package build info to api
- Adds `build_info` object to package api - Specs for the new object
parent
3652e284
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
3 deletions
+60
-3
changelogs/unreleased/33596-package-ci-package-pipeline-api.yml
...logs/unreleased/33596-package-ci-package-pipeline-api.yml
+5
-0
doc/api/packages.md
doc/api/packages.md
+12
-3
ee/lib/ee/api/entities.rb
ee/lib/ee/api/entities.rb
+5
-0
ee/spec/factories/packages.rb
ee/spec/factories/packages.rb
+9
-0
ee/spec/fixtures/api/schemas/public_api/v4/packages/package_with_build.json
...pi/schemas/public_api/v4/packages/package_with_build.json
+16
-0
ee/spec/requests/api/project_packages_spec.rb
ee/spec/requests/api/project_packages_spec.rb
+13
-0
No files found.
changelogs/unreleased/33596-package-ci-package-pipeline-api.yml
0 → 100644
View file @
98522292
---
title
:
Add build metadata to package API
merge_request
:
20682
author
:
type
:
added
doc/api/packages.md
View file @
98522292
...
...
@@ -79,7 +79,10 @@ Example response:
"web_path"
:
"/namespace1/project1/-/packages/1"
,
"delete_api_path"
:
"/namespace1/project1/-/packages/1"
},
"created_at"
:
"2019-11-27T03:37:38.711Z"
"created_at"
:
"2019-11-27T03:37:38.711Z"
,
"build_info"
:
{
"pipeline_id"
:
123
}
},
{
"id"
:
2
,
...
...
@@ -90,7 +93,10 @@ Example response:
"web_path"
:
"/namespace1/project1/-/packages/1"
,
"delete_api_path"
:
"/namespace1/project1/-/packages/1"
},
"created_at"
:
"2019-11-27T03:37:38.711Z"
"created_at"
:
"2019-11-27T03:37:38.711Z"
,
"build_info"
:
{
"pipeline_id"
:
123
}
}
]
```
...
...
@@ -133,7 +139,10 @@ Example response:
"web_path"
:
"/namespace1/project1/-/packages/1"
,
"delete_api_path"
:
"/namespace1/project1/-/packages/1"
},
"created_at"
:
"2019-11-27T03:37:38.711Z"
"created_at"
:
"2019-11-27T03:37:38.711Z"
,
"build_info"
:
{
"pipeline_id"
:
123
}
}
```
...
...
ee/lib/ee/api/entities.rb
View file @
98522292
...
...
@@ -875,6 +875,10 @@ module EE
include
::
API
::
Helpers
::
RelatedResourcesHelpers
extend
EntityHelpers
class
BuildInfo
<
Grape
::
Entity
expose
:pipeline_id
end
expose
:id
expose
:name
expose
:version
...
...
@@ -893,6 +897,7 @@ module EE
expose
:created_at
expose
:project_id
,
if:
->
(
_
,
opts
)
{
opts
[
:group
]
}
expose
:project_path
,
if:
->
(
obj
,
opts
)
{
opts
[
:group
]
&&
Ability
.
allowed?
(
opts
[
:user
],
:read_project
,
obj
.
project
)
}
expose
:build_info
,
using:
BuildInfo
private
...
...
ee/spec/factories/packages.rb
View file @
98522292
...
...
@@ -28,6 +28,12 @@ FactoryBot.define do
after
:create
do
|
package
|
create
:package_file
,
:npm
,
package:
package
end
trait
:with_build
do
after
:create
do
|
package
|
create
:package_build_info
,
package:
package
,
pipeline:
create
(
:ci_build
,
user:
package
.
project
.
creator
).
pipeline
end
end
end
factory
:nuget_package
do
...
...
@@ -59,6 +65,9 @@ FactoryBot.define do
end
end
factory
:package_build_info
,
class:
Packages
::
BuildInfo
do
end
factory
:package_file
,
class:
Packages
::
PackageFile
do
package
...
...
ee/spec/fixtures/api/schemas/public_api/v4/packages/package_with_build.json
0 → 100644
View file @
98522292
{
"type"
:
"object"
,
"required"
:
[
"name"
,
"version"
,
"package_type"
],
"properties"
:
{
"name"
:
{
"type"
:
"string"
},
"version"
:
{
"type"
:
"string"
},
"package_type"
:
{
"type"
:
"string"
},
"build_info"
:
{
"type"
:
"object"
,
"required"
:
[
"pipeline_id"
],
"properties"
:
{
"pipeline_id"
:
{
"type"
:
"integer"
}
}
}
}
}
ee/spec/requests/api/project_packages_spec.rb
View file @
98522292
...
...
@@ -167,6 +167,19 @@ describe API::ProjectPackages do
it_behaves_like
'destroy url'
end
context
'with build info'
do
let!
(
:package1
)
{
create
(
:npm_package
,
:with_build
,
project:
project
)
}
it
'returns the build info'
do
project
.
add_developer
(
user
)
get
api
(
package_url
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/packages/package_with_build'
,
dir:
'ee'
)
end
end
end
end
...
...
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