Skip to content

Add ContainerRepositories API

Steve Abrams requested to merge 209916-container-repository-api into master

What does this MR do?

This MR adds an endpoint for container repositories that is not nested beneath projects or groups:

GET gitlab.example.com/api/v4/registry/repositories/:id

Screenshots (strongly suggested)

Basic request
curl -H "Private-Token: <token>" "http://gdk.test:3001/api/v4/registry/repositories/21"

{
  "id": 21,
  "name": "31497",
  "path": "root/cleanup-policy-test/31497",
  "project_id": 21,
  "location": "gdk.test:5000/root/cleanup-policy-test/31497",
  "created_at": "2020-09-28T16:37:43.484Z",
  "cleanup_policy_started_at": null,
  "delete_api_path": "http://gdk.test:3001/api/v4/projects/21/registry/repositories/21"
}
With params
curl -H "Private-Token: <token>" "http://gdk.test:3001/api/v4/registry/repositories/21?tags=1&tags_count=1"

{
  "id": 21,
  "name": "31497",
  "path": "root/cleanup-policy-test/31497",
  "project_id": 21,
  "location": "gdk.test:5000/root/cleanup-policy-test/31497",
  "created_at": "2020-09-28T16:37:43.484Z",
  "cleanup_policy_started_at": null,
  "tags_count": 1,
  "tags": [
    {
      "name": "test-12034",
      "path": "root/cleanup-policy-test/31497:test-12034",
      "location": "gdk.test:5000/root/cleanup-policy-test/31497:test-12034"
    }
  ],
  "delete_api_path": "http://gdk.test:3001/api/v4/projects/21/registry/repositories/21"
}
With no credentials
curl "http://gdk.test:3001/api/v4/registry/repositories/21?tags=1&tags_count=1"

{"message":"401 Unauthorized"}
With no access to the requested repository
curl -H "Private-Token: <token without access>" "http://gdk.test:3001/api/v4/registry/repositories/21"

{"message":"403 Forbidden"}

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Related to #209916 (closed)

Edited by Steve Abrams

Merge request reports