Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

RFE: Support deployment approve/reject #2253

Closed
@JohnVillalovos

Description

@JohnVillalovos

Discussed in#2252

Originally posted byjbotello7381 August 23, 2022
I was playing with deployment and gitlab python library, and notice there's no method to approve or reject a deployment? i was able to do it via REST API from my python code, but not via the python wrapper. I'm using 3.8.1 of the gitlab python library.

So it looks like it is this API:
https://docs.gitlab.com/ee/api/deployments.html#approve-or-reject-a-blocked-deployment

And it doesn't look like there is any support for that yet in:
https://github.com/python-gitlab/python-gitlab/blob/main/gitlab/v4/objects/deployments.py

Implementing it will look similar to how the "approve" method is done for a merge request.

@cli.register_custom_action("ProjectMergeRequest", (), ("sha",))
@exc.on_http_error(exc.GitlabMRApprovalError)
defapprove(self,sha:Optional[str]=None,**kwargs:Any)->Dict[str,Any]:
"""Approve the merge request.
Args:
sha: Head SHA of MR
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabMRApprovalError: If the approval failed
Returns:
A dict containing the result.
https://docs.gitlab.com/ee/api/merge_request_approvals.html#approve-merge-request
"""
path=f"{self.manager.path}/{self.encoded_id}/approve"
data= {}
ifsha:
data["sha"]=sha
server_data=self.manager.gitlab.http_post(path,post_data=data,**kwargs)
ifTYPE_CHECKING:
assertisinstance(server_data,dict)
self._update_attrs(server_data)
returnserver_data

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp