Skip to content

Commit af3f374

Browse files
Merge branch 'python-gitlab:main' into fix/add-missing-status-check-methods
2 parents 61ba6bd + 22be96c commit af3f374

File tree

5 files changed

+33
-14
lines changed

5 files changed

+33
-14
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,13 @@ jobs:
2626
- name: Set up Python
2727
uses: actions/setup-python@v5.4.0
2828
with:
29-
python-version: "3.12"
29+
python-version: "3.13"
3030
- name: Install dependencies
3131
run: pip install tox
3232
- name: Build docs
3333
env:
3434
TOXENV: docs
3535
run: tox
36-
- name: Archive generated docs
37-
uses: actions/upload-artifact@v4.6.0
38-
with:
39-
name: html-docs
40-
path: build/sphinx/html/
4136

4237
twine-check:
4338
runs-on: ubuntu-24.04
@@ -46,7 +41,7 @@ jobs:
4641
- name: Set up Python
4742
uses: actions/setup-python@v5.4.0
4843
with:
49-
python-version: "3.12"
44+
python-version: "3.13"
5045
- name: Install dependencies
5146
run: pip install tox twine wheel
5247
- name: Check twine readme rendering

docs/gl_objects/deploy_keys.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ Reference
1919
Examples
2020
--------
2121

22-
List the deploy keys::
22+
Add an instance-wide deploy key (requires admin access)::
23+
24+
keys = gl.deploykeys.create({'title': 'instance key', 'key': INSTANCE_KEY})
25+
26+
List all deploy keys::
2327

2428
keys = gl.deploykeys.list()
2529

gitlab/v4/objects/deploy_keys.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@
77
from gitlab import cli
88
from gitlab import exceptions as exc
99
from gitlab.base import RESTObject
10-
from gitlab.mixins import CRUDMixin, ListMixin, ObjectDeleteMixin, SaveMixin
10+
from gitlab.mixins import (
11+
CreateMixin,
12+
CRUDMixin,
13+
ListMixin,
14+
ObjectDeleteMixin,
15+
SaveMixin,
16+
)
1117
from gitlab.types import RequiredOptional
1218

1319
__all__ = ["DeployKey", "DeployKeyManager", "ProjectKey", "ProjectKeyManager"]
@@ -17,9 +23,12 @@ class DeployKey(RESTObject):
1723
pass
1824

1925

20-
class DeployKeyManager(ListMixin[DeployKey]):
26+
class DeployKeyManager(CreateMixin[DeployKey], ListMixin[DeployKey]):
2127
_path = "/deploy_keys"
2228
_obj_cls = DeployKey
29+
_create_attrs = RequiredOptional(
30+
required=("title", "key"), optional=("expires_at",)
31+
)
2332

2433

2534
class ProjectKey(SaveMixin, ObjectDeleteMixin, RESTObject):
@@ -30,8 +39,10 @@ class ProjectKeyManager(CRUDMixin[ProjectKey]):
3039
_path = "/projects/{project_id}/deploy_keys"
3140
_obj_cls = ProjectKey
3241
_from_parent_attrs = {"project_id": "id"}
33-
_create_attrs = RequiredOptional(required=("title", "key"), optional=("can_push",))
34-
_update_attrs = RequiredOptional(optional=("title", "can_push"))
42+
_create_attrs = RequiredOptional(
43+
required=("title", "key"), optional=("can_push", "expires_at")
44+
)
45+
_update_attrs = RequiredOptional(optional=("title", "can_push", "expires_at"))
3546

3647
@cli.register_custom_action(
3748
cls_names="ProjectKeyManager",

tests/functional/api/test_deploy_keys.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
def test_project_deploy_keys(gl, project, DEPLOY_KEY):
1+
from gitlab import Gitlab
2+
from gitlab.v4.objects import Project
3+
4+
5+
def test_deploy_keys(gl: Gitlab, DEPLOY_KEY: str) -> None:
6+
deploy_key = gl.deploykeys.create({"title": "foo@bar", "key": DEPLOY_KEY})
7+
assert deploy_key in gl.deploykeys.list(get_all=False)
8+
9+
10+
def test_project_deploy_keys(gl: Gitlab, project: Project, DEPLOY_KEY: str) -> None:
211
deploy_key = project.keys.create({"title": "foo@bar", "key": DEPLOY_KEY})
312
assert deploy_key in project.keys.list()
413

tests/unit/objects/test_status_checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
mr_content = {
99
"id": 1,
1010
"iid": 1,
11-
"project_id": 3,
11+
"project_id": 1,
1212
"title": "test1",
1313
"description": "fixed login page css paddings",
1414
"state": "merged",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy