Skip to content

Commit 5a75310

Browse files
authored
Merge pull request #1082 from python-gitlab/chore/signature-gpg-x509
chore: bring commit signatures up to date with 12.10
2 parents 9d66cb3 + e6c9fe9 commit 5a75310

File tree

5 files changed

+14
-19
lines changed

5 files changed

+14
-19
lines changed

docs/cli.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Get a specific project commit by its SHA id:
258258
259259
$ gitlab project-commit get --project-id 2 --id a43290c
260260
261-
Get the GPG signature of a signed commit:
261+
Get the signature (e.g. GPG or x509) of a signed commit:
262262

263263
.. code-block:: console
264264

docs/gl_objects/commits.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Get the references the commit has been pushed to (branches and tags)::
8282
commit.refs('tag') # only tags
8383
commit.refs('branch') # only branches
8484

85-
Get the GPG signature of the commit (if the commit was signed)::
85+
Get the signature of the commit (if the commit was signed, e.g. with GPG or x509)::
8686

8787
commit.signature()
8888

gitlab/v4/objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,7 +2299,7 @@ def revert(self, branch, **kwargs):
22992299
@cli.register_custom_action("ProjectCommit")
23002300
@exc.on_http_error(exc.GitlabGetError)
23012301
def signature(self, **kwargs):
2302-
"""Get the GPG signature of the commit.
2302+
"""Get the signature of the commit.
23032303
23042304
Args:
23052305
**kwargs: Extra options to send to the server (e.g. sudo)
@@ -2309,7 +2309,7 @@ def signature(self, **kwargs):
23092309
GitlabGetError: If the signature could not be retrieved
23102310
23112311
Returns:
2312-
dict: The commit's GPG signature data
2312+
dict: The commit's signature data
23132313
"""
23142314
path = "%s/%s/signature" % (self.manager.path, self.get_id())
23152315
return self.manager.gitlab.http_get(path, **kwargs)

tools/cli_test_v4.sh

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ testcase "revert commit" '
113113
--id "$COMMIT_ID" --branch master
114114
'
115115

116-
# Test commit GPG signature
117-
testcase "attempt to get GPG signature of unsigned commit" '
116+
# Test commit signature
117+
testcase "attempt to get signature of unsigned commit" '
118118
OUTPUT=$(GITLAB project-commit signature --project-id "$PROJECT_ID" \
119119
--id "$COMMIT_ID" 2>&1 || exit 0)
120-
echo "$OUTPUT" | grep -q "404 GPG Signature Not Found"
120+
echo "$OUTPUT" | grep -q "404 Signature Not Found"
121121
'
122122

123123
# Test project labels
@@ -218,23 +218,18 @@ testcase "values from files" '
218218
CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT=$(GITLAB -v project-deploy-token create --project-id $PROJECT_ID \
219219
--name foo --username root --expires-at "2021-09-09" --scopes "read_registry")
220220
CREATED_DEPLOY_TOKEN_ID=$(echo "$CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT" | grep ^id: | cut -d" " -f2)
221-
testcase "create project deploy token" '
221+
testcase "create project deploy token (name)" '
222222
echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep -q "name: foo"
223223
'
224-
testcase "create project deploy token" '
224+
testcase "create project deploy token (expires-at)" '
225225
echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep -q "expires-at: 2021-09-09T00:00:00.000Z"
226226
'
227-
testcase "create project deploy token" '
227+
testcase "create project deploy token (scopes)" '
228228
echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep "scopes: " | grep -q "read_registry"
229229
'
230-
# Uncomment once https://gitlab.com/gitlab-org/gitlab/-/issues/211963 is fixed
231-
#testcase "create project deploy token" '
232-
# echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep -q "username: root"
233-
#'
234230

235-
# Remove once https://gitlab.com/gitlab-org/gitlab/-/issues/211963 is fixed
236-
testcase "create project deploy token" '
237-
echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep -q "gitlab+deploy-token"
231+
testcase "create project deploy token (username)" '
232+
echo $CREATE_PROJECT_DEPLOY_TOKEN_OUTPUT | grep -q "username: root"
238233
'
239234

240235
LIST_DEPLOY_TOKEN_OUTPUT=$(GITLAB -v deploy-token list)

tools/python_test_v4.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,13 +500,13 @@
500500
# assert commit.refs()
501501
# assert commit.merge_requests()
502502

503-
# commit GPG signature (for unsigned commits)
503+
# commit signature (for unsigned commits)
504504
# TODO: reasonable tests for signed commits?
505505
try:
506506
signature = commit.signature()
507507
except gitlab.GitlabGetError as e:
508508
error_message = e.error_message
509-
assert error_message == "404 GPG Signature Not Found"
509+
assert error_message == "404 Signature Not Found"
510510

511511
# commit comment
512512
commit.comments.create({"note": "This is a commit comment"})

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