Skip to content

ProjectRemoteMirror: Add support for retrieving public key #3349

@amimas

Description

@amimas

Description of the problem, including code/CLI snippet

GitLab API for remote mirror has an endpoint for retrieving SSH public key, if authentication method is set to ssh_public_key.

https://docs.gitlab.com/api/remote_mirrors/#retrieve-a-public-key-for-a-remote-mirror

But the ProjectRemoteMirror in this library currently doesn't have any support for the above endpoint.

class ProjectRemoteMirror(ObjectDeleteMixin, SaveMixin, RESTObject):
@cli.register_custom_action(cls_names="ProjectRemoteMirror")
@exc.on_http_error(exc.GitlabCreateError)
def sync(self, **kwargs: Any) -> dict[str, Any] | requests.Response:
"""Force push mirror update.
Args:
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the server cannot perform the request
"""
path = f"{self.manager.path}/{self.encoded_id}/sync"
return self.manager.gitlab.http_post(path, **kwargs)

Expected Behavior

Ability to retrieve SSH public key for SSH based remote mirrors.

Actual Behavior

No option for retrieving SSH public key for SSH based remote mirrors.

Specifications

  • python-gitlab version: 7.1.0
  • Gitlab server version (or gitlab.com): 18.8.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions