File: protected_container_repositories.rst

package info (click to toggle)
python-gitlab 1%3A4.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,048 kB
  • sloc: python: 24,168; makefile: 171; ruby: 27; javascript: 3
file content (44 lines) | stat: -rw-r--r-- 1,252 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
################################
Protected container repositories
################################

You can list and manage container registry protection rules in a project.

References
----------

* v4 API:

  + :class:`gitlab.v4.objects.ProjectRegistryProtectionRuleRule`
  + :class:`gitlab.v4.objects.ProjectRegistryProtectionRuleRuleManager`
  + :attr:`gitlab.v4.objects.Project.registry_protection_rules`

* GitLab API: https://docs.gitlab.com/ee/api/project_container_registry_protection_rules.html

Examples
--------

List the container registry protection rules for a project::

    registry_rules = project.registry_protection_rules.list()

Create a container registry protection rule::

    registry_rule = project.registry_protection_rules.create(
        {
            'repository_path_pattern': 'test/image',
            'minimum_access_level_for_push': 'maintainer',
            'minimum_access_level_for_delete': 'maintainer',
        }
    )

Update a container registry protection rule::

    registry_rule.minimum_access_level_for_push = 'owner'
    registry_rule.save()

Delete a container registry protection rule::

    registry_rule = project.registry_protection_rules.delete(registry_rule.id)
    # or
    registry_rule.delete()