Module: Gitlab::Client::ContainerRegistry

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/container_registry.rb

Overview

Defines methods related to GitLab Container Registry.

Instance Method Summary collapse

Instance Method Details

#bulk_delete_registry_repository_tags(project, repository_id, options = {}) ⇒ void

This method returns an undefined value.

Delete repository tags in bulk based on given criteria.

Examples:

Gitlab.bulk_delete_registry_repository_tags(5, 2, name_regex: '.*')
Gitlab.bulk_delete_registry_repository_tags(5, 2, name_regex: '[0-9a-z]{40}', keep_n: 5, older_than: '1d')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • repository_id (Integer)

    The ID of registry repository.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :name_regex(required) (String)

    The regex of the name to delete. To delete all tags specify .*.

  • :keep_n(optional) (Integer)

    The amount of latest tags of given name to keep.

  • :older_than(required) (String)

    Tags to delete that are older than the given time, written in human readable form 1h, 1d, 1month.



81
82
83
# File 'lib/gitlab/client/container_registry.rb', line 81

def bulk_delete_registry_repository_tags(project, repository_id, options = {})
  delete("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags", body: options)
end

#delete_registry_repository(project, id) ⇒ void

This method returns an undefined value.

Delete a repository in registry.

Examples:

Gitlab.delete_registry_repository(5, 2)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of registry repository.



26
27
28
# File 'lib/gitlab/client/container_registry.rb', line 26

def delete_registry_repository(project, id)
  delete("/projects/#{url_encode project}/registry/repositories/#{id}")
end

#delete_registry_repository_tag(project, repository_id, tag_name) ⇒ void

This method returns an undefined value.

Delete a registry repository tag.

Examples:

Gitlab.delete_registry_repository_tag(5, 2, 'v10.0.0')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • repository_id (Integer)

    The ID of registry repository.

  • tag_name (String)

    The name of tag.



64
65
66
# File 'lib/gitlab/client/container_registry.rb', line 64

def delete_registry_repository_tag(project, repository_id, tag_name)
  delete("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags/#{tag_name}")
end

#registry_repositories(project) ⇒ Array<Gitlab::ObjectifiedHash>

Get a list of registry repositories in a project.

Examples:

Gitlab.registry_repositories(5)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

Returns:



14
15
16
# File 'lib/gitlab/client/container_registry.rb', line 14

def registry_repositories(project)
  get("/projects/#{url_encode project}/registry/repositories")
end

#registry_repository_tag(project, repository_id, tag_name) ⇒ Gitlab::ObjectifiedHash

Get details of a registry repository tag.

Examples:

Gitlab.registry_repository_tag(5, 2, 'v10.0.0')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • repository_id (Integer)

    The ID of registry repository.

  • tag_name (String)

    The name of tag.

Returns:



51
52
53
# File 'lib/gitlab/client/container_registry.rb', line 51

def registry_repository_tag(project, repository_id, tag_name)
  get("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags/#{tag_name}")
end

#registry_repository_tags(project, repository_id) ⇒ Array<Gitlab::ObjectifiedHash>

Get a list of tags for given registry repository.

Examples:

Gitlab.registry_repository_tags(5, 2)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • repository_id (Integer)

    The ID of registry repository.

Returns:



38
39
40
# File 'lib/gitlab/client/container_registry.rb', line 38

def registry_repository_tags(project, repository_id)
  get("/projects/#{url_encode project}/registry/repositories/#{repository_id}/tags")
end