Skip to main content

prefect_gitlab.credentials

Module used to enable authenticated interactions with GitLab

Classes

GitLabCredentials

Store a GitLab personal access token to interact with private GitLab repositories. Attributes:
  • token: The personal access token to authenticate with GitLab.
  • url: URL to self-hosted GitLab instances.
Examples: Load stored GitLab credentials:
Methods:

format_git_credentials

Format and return the full git URL with GitLab credentials embedded. Handles both personal access tokens and deploy tokens correctly:
  • Personal access tokens: prefixed with “oauth2:”
  • Deploy tokens (username:token format): used as-is
  • Already prefixed tokens: not double-prefixed
Args: Returns:
  • Complete URL with credentials embedded
Raises:
  • ValueError: If token is not configured

get_client

Gets an authenticated GitLab client. Returns:
  • An authenticated GitLab client.