Commit 68e10d3f authored by Nick Kipling's avatar Nick Kipling

Created Package Pipeline and updated docs

Created Package Pipeline entity for API
Updated the Package entity to support this
Updated the docs with deprecation notice
Removed BuildInfo entity
parent 448056f0
...@@ -73,6 +73,10 @@ GET /groups/:id/packages ...@@ -73,6 +73,10 @@ GET /groups/:id/packages
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/:id/packages?exclude_subgroups=true curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/:id/packages?exclude_subgroups=true
``` ```
CAUTION: **Deprecation**
> The `build_info` attribute in the response is deprecated in favour of `pipeline`.
> Introduced [GitLab 12.10](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/28040).
Example response: Example response:
```json ```json
...@@ -154,6 +158,10 @@ GET /projects/:id/packages/:package_id ...@@ -154,6 +158,10 @@ GET /projects/:id/packages/:package_id
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/:id/packages/:package_id curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/:id/packages/:package_id
``` ```
CAUTION: **Deprecation**
> The `build_info` attribute in the response is deprecated in favour of `pipeline`.
> Introduced [GitLab 12.10](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/28040).
Example response: Example response:
```json ```json
......
...@@ -27,17 +27,17 @@ module EE ...@@ -27,17 +27,17 @@ module EE
expose :project_path, if: ->(obj, opts) { opts[:group] && Ability.allowed?(opts[:user], :read_project, obj.project) } expose :project_path, if: ->(obj, opts) { opts[:group] && Ability.allowed?(opts[:user], :read_project, obj.project) }
expose :tags expose :tags
PIPELINE_PROPS = [:created_at, :id, :sha, :ref, :status, :updated_at, :web_url, user: [:name, :avatar_url]].freeze expose :pipeline, if: ->(package) { package.build_info }, using: Package::Pipeline
expose :pipeline, if: ->(obj) { obj.build_info } do |package|
::API::Entities::Pipeline.represent package.build_info.pipeline, only: PIPELINE_PROPS
end
private private
def project_path def project_path
object.project.full_path object.project.full_path
end end
def pipeline
object.build_info.pipeline
end
end end
end end
end end
......
...@@ -4,8 +4,8 @@ module EE ...@@ -4,8 +4,8 @@ module EE
module API module API
module Entities module Entities
class Package < Grape::Entity class Package < Grape::Entity
class BuildInfo < Grape::Entity class Pipeline < ::API::Entities::PipelineBasic
expose :pipeline, using: ::API::Entities::PipelineBasic expose :user, using: ::API::Entities::UserBasic
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment