From 01d41946cbb1a4e5f29752eac89239d635c2ec6f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 01:30:54 +0000 Subject: [PATCH 1/5] chore(deps): update dependency jinja2 to v3.1.5 [security] --- requirements-docs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-docs.txt b/requirements-docs.txt index 52f0acb7d..ab15d4858 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -1,6 +1,6 @@ -r requirements.txt furo==2024.8.6 -jinja2==3.1.4 +jinja2==3.1.5 myst-parser==4.0.0 sphinx==8.1.3 sphinxcontrib-autoprogram==0.1.9 From f4f7d7a63716f072eb45db2c7f590db0435350f0 Mon Sep 17 00:00:00 2001 From: Takeru Tanaka Date: Fri, 27 Dec 2024 12:07:05 +0900 Subject: [PATCH 2/5] fix(api): allow configuration of keep_base_url from file --- gitlab/client.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gitlab/client.py b/gitlab/client.py index a1b804e33..bf3ffbafc 100644 --- a/gitlab/client.py +++ b/gitlab/client.py @@ -303,6 +303,7 @@ def from_config( order_by=config.order_by, user_agent=config.user_agent, retry_transient_errors=config.retry_transient_errors, + keep_base_url=config.keep_base_url, **kwargs, ) From 8c1aaa3f6a797caf7bd79a7da083eae56c6250ff Mon Sep 17 00:00:00 2001 From: Max Wittig Date: Tue, 7 Jan 2025 11:56:03 +0100 Subject: [PATCH 3/5] fix(registry-protection): fix api url See: https://docs.gitlab.com/ee/api/container_repository_protection_rules.html#list-container-repository-protection-rules --- docs/gl_objects/protected_container_repositories.rst | 8 ++++---- gitlab/v4/objects/__init__.py | 2 +- gitlab/v4/objects/projects.py | 8 ++++---- ...es.py => registry_protection_repository_rules.py} | 2 +- tests/functional/api/test_registry.py | 4 ++-- tests/unit/objects/test_registry_protection_rules.py | 12 ++++++------ 6 files changed, 18 insertions(+), 18 deletions(-) rename gitlab/v4/objects/{registry_repository_protection_rules.py => registry_protection_repository_rules.py} (93%) diff --git a/docs/gl_objects/protected_container_repositories.rst b/docs/gl_objects/protected_container_repositories.rst index a5a939762..affdd04a9 100644 --- a/docs/gl_objects/protected_container_repositories.rst +++ b/docs/gl_objects/protected_container_repositories.rst @@ -11,7 +11,7 @@ References + :class:`gitlab.v4.objects.ProjectRegistryRepositoryProtectionRuleRule` + :class:`gitlab.v4.objects.ProjectRegistryRepositoryProtectionRuleRuleManager` - + :attr:`gitlab.v4.objects.Project.registry_repository_protection_rules` + + :attr:`gitlab.v4.objects.Project.registry_protection_repository_rules` * GitLab API: https://docs.gitlab.com/ee/api/container_repository_protection_rules.html @@ -20,11 +20,11 @@ Examples List the container registry protection rules for a project:: - registry_rules = project.registry_repository_protection_rules.list() + registry_rules = project.registry_protection_repository_rules.list() Create a container registry protection rule:: - registry_rule = project.registry_repository_protection_rules.create( + registry_rule = project.registry_protection_repository_rules.create( { 'repository_path_pattern': 'test/image', 'minimum_access_level_for_push': 'maintainer', @@ -39,6 +39,6 @@ Update a container registry protection rule:: Delete a container registry protection rule:: - registry_rule = project.registry_repository_protection_rules.delete(registry_rule.id) + registry_rule = project.registry_protection_repository_rules.delete(registry_rule.id) # or registry_rule.delete() diff --git a/gitlab/v4/objects/__init__.py b/gitlab/v4/objects/__init__.py index d09b35675..3aa992203 100644 --- a/gitlab/v4/objects/__init__.py +++ b/gitlab/v4/objects/__init__.py @@ -55,8 +55,8 @@ from .project_access_tokens import * from .projects import * from .push_rules import * +from .registry_protection_repository_rules import * from .registry_protection_rules import * -from .registry_repository_protection_rules import * from .releases import * from .repositories import * from .resource_groups import * diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py index ec54fd3c4..1fb36a01e 100644 --- a/gitlab/v4/objects/projects.py +++ b/gitlab/v4/objects/projects.py @@ -86,12 +86,12 @@ ) from .project_access_tokens import ProjectAccessTokenManager # noqa: F401 from .push_rules import ProjectPushRulesManager # noqa: F401 +from .registry_protection_repository_rules import ( # noqa: F401 + ProjectRegistryRepositoryProtectionRuleManager, +) from .registry_protection_rules import ( # noqa: F401; deprecated ProjectRegistryProtectionRuleManager, ) -from .registry_repository_protection_rules import ( # noqa: F401 - ProjectRegistryRepositoryProtectionRuleManager, -) from .releases import ProjectReleaseManager # noqa: F401 from .repositories import RepositoryMixin from .resource_groups import ProjectResourceGroupManager @@ -242,7 +242,7 @@ class Project( protectedtags: ProjectProtectedTagManager pushrules: ProjectPushRulesManager registry_protection_rules: ProjectRegistryProtectionRuleManager - registry_repository_protection_rules: ProjectRegistryRepositoryProtectionRuleManager + registry_protection_repository_rules: ProjectRegistryRepositoryProtectionRuleManager releases: ProjectReleaseManager resource_groups: ProjectResourceGroupManager remote_mirrors: "ProjectRemoteMirrorManager" diff --git a/gitlab/v4/objects/registry_repository_protection_rules.py b/gitlab/v4/objects/registry_protection_repository_rules.py similarity index 93% rename from gitlab/v4/objects/registry_repository_protection_rules.py rename to gitlab/v4/objects/registry_protection_repository_rules.py index 3c14e25f5..a73629e39 100644 --- a/gitlab/v4/objects/registry_repository_protection_rules.py +++ b/gitlab/v4/objects/registry_protection_repository_rules.py @@ -15,7 +15,7 @@ class ProjectRegistryRepositoryProtectionRule(SaveMixin, RESTObject): class ProjectRegistryRepositoryProtectionRuleManager( ListMixin, CreateMixin, UpdateMixin, RESTManager ): - _path = "/projects/{project_id}/registry/repository/protection/rules" + _path = "/projects/{project_id}/registry/protection/repository/rules" _obj_cls = ProjectRegistryRepositoryProtectionRule _from_parent_attrs = {"project_id": "id"} _create_attrs = RequiredOptional( diff --git a/tests/functional/api/test_registry.py b/tests/functional/api/test_registry.py index 4642a04bf..91fdceacc 100644 --- a/tests/functional/api/test_registry.py +++ b/tests/functional/api/test_registry.py @@ -11,10 +11,10 @@ def protected_registry_feature(gl: Gitlab): @pytest.mark.skip(reason="Not released yet") def test_project_protected_registry(project: Project): - rules = project.registry_repository_protection_rules.list() + rules = project.registry_protection_repository_rules.list() assert isinstance(rules, list) - protected_registry = project.registry_repository_protection_rules.create( + protected_registry = project.registry_protection_repository_rules.create( { "repository_path_pattern": "test/image", "minimum_access_level_for_push": "maintainer", diff --git a/tests/unit/objects/test_registry_protection_rules.py b/tests/unit/objects/test_registry_protection_rules.py index 53af1ba6c..3078278f5 100644 --- a/tests/unit/objects/test_registry_protection_rules.py +++ b/tests/unit/objects/test_registry_protection_rules.py @@ -21,7 +21,7 @@ def resp_list_protected_registries(): with responses.RequestsMock() as rsps: rsps.add( method=responses.GET, - url="http://localhost/api/v4/projects/1/registry/repository/protection/rules", + url="http://localhost/api/v4/projects/1/registry/protection/repository/rules", json=[protected_registry_content], content_type="application/json", status=200, @@ -34,7 +34,7 @@ def resp_create_protected_registry(): with responses.RequestsMock() as rsps: rsps.add( method=responses.POST, - url="http://localhost/api/v4/projects/1/registry/repository/protection/rules", + url="http://localhost/api/v4/projects/1/registry/protection/repository/rules", json=protected_registry_content, content_type="application/json", status=201, @@ -50,7 +50,7 @@ def resp_update_protected_registry(): with responses.RequestsMock() as rsps: rsps.add( method=responses.PATCH, - url="http://localhost/api/v4/projects/1/registry/repository/protection/rules/1", + url="http://localhost/api/v4/projects/1/registry/protection/repository/rules/1", json=updated_content, content_type="application/json", status=200, @@ -59,13 +59,13 @@ def resp_update_protected_registry(): def test_list_project_protected_registries(project, resp_list_protected_registries): - protected_registry = project.registry_repository_protection_rules.list()[0] + protected_registry = project.registry_protection_repository_rules.list()[0] assert isinstance(protected_registry, ProjectRegistryRepositoryProtectionRule) assert protected_registry.repository_path_pattern == "test/image" def test_create_project_protected_registry(project, resp_create_protected_registry): - protected_registry = project.registry_repository_protection_rules.create( + protected_registry = project.registry_protection_repository_rules.create( { "repository_path_pattern": "test/image", "minimum_access_level_for_push": "maintainer", @@ -76,7 +76,7 @@ def test_create_project_protected_registry(project, resp_create_protected_regist def test_update_project_protected_registry(project, resp_update_protected_registry): - updated = project.registry_repository_protection_rules.update( + updated = project.registry_protection_repository_rules.update( 1, {"repository_path_pattern": "abc*"} ) assert updated["repository_path_pattern"] == "abc*" From 912e1a0620a96c56081ffec284c2cac871cb7626 Mon Sep 17 00:00:00 2001 From: Max Wittig Date: Tue, 7 Jan 2025 07:43:35 -0800 Subject: [PATCH 4/5] chore: bump to 5.3.1 --- CHANGELOG.md | 6 ++++++ gitlab/_version.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 972ed3a79..85036e182 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## v5.3.1 (2025-01-07) + +### Bug Fixes + +- Fix container registry protection rules to use the correct URL for endpoint + ([#3079](https://github.com/python-gitlab/python-gitlab/pull/3079)) ## v5.3.0 (2024-12-28) diff --git a/gitlab/_version.py b/gitlab/_version.py index 85a9c1333..b772bcf4f 100644 --- a/gitlab/_version.py +++ b/gitlab/_version.py @@ -3,4 +3,4 @@ __email__ = "gauvainpocentek@gmail.com" __license__ = "LGPL3" __title__ = "python-gitlab" -__version__ = "5.3.0" +__version__ = "5.3.1" From e4c5c74fbe98b92e575d29e929dae112b87f0fb2 Mon Sep 17 00:00:00 2001 From: semantic-release Date: Tue, 7 Jan 2025 16:34:34 +0000 Subject: [PATCH 5/5] chore: release v5.3.1 --- CHANGELOG.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85036e182..842aacf74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,27 @@ # CHANGELOG + ## v5.3.1 (2025-01-07) ### Bug Fixes -- Fix container registry protection rules to use the correct URL for endpoint - ([#3079](https://github.com/python-gitlab/python-gitlab/pull/3079)) +- **api**: Allow configuration of keep_base_url from file + ([`f4f7d7a`](https://github.com/python-gitlab/python-gitlab/commit/f4f7d7a63716f072eb45db2c7f590db0435350f0)) + +- **registry-protection**: Fix api url + ([`8c1aaa3`](https://github.com/python-gitlab/python-gitlab/commit/8c1aaa3f6a797caf7bd79a7da083eae56c6250ff)) + +See: + https://docs.gitlab.com/ee/api/container_repository_protection_rules.html#list-container-repository-protection-rules + +### Chores + +- Bump to 5.3.1 + ([`912e1a0`](https://github.com/python-gitlab/python-gitlab/commit/912e1a0620a96c56081ffec284c2cac871cb7626)) + +- **deps**: Update dependency jinja2 to v3.1.5 [security] + ([`01d4194`](https://github.com/python-gitlab/python-gitlab/commit/01d41946cbb1a4e5f29752eac89239d635c2ec6f)) + ## v5.3.0 (2024-12-28)