semantic_release.hvcs.bitbucket module

Helper code for interacting with a Bitbucket remote VCS

class semantic_release.hvcs.bitbucket.Bitbucket(remote_url: str, *, hvcs_domain: str | None = None, hvcs_api_domain: str | None = None, token: str | None = None, allow_insecure: bool = False, **kwargs: Any)[source]

Bases: RemoteHvcsBase

Bitbucket HVCS interface for interacting with BitBucket repositories

This class supports the following products:

  • BitBucket Cloud

  • BitBucket Data Center Server (on-premises installations)

This interface does its best to detect which product is configured based on the provided domain. If it is the official bitbucket.org, the default domain, then it is considered as BitBucket Cloud which uses the subdomain api.bitbucket.org/2.0 for api communication.

If the provided domain is anything else, than it is assumed to be communicating with an on-premise or 3rd-party maintained BitBucket instance which matches with the BitBucket Data Center Server product. The on-prem server product uses a path prefix for handling api requests which is configured to be server.domain/rest/api/1.0 based on the documentation in April 2024.

DEFAULT_API_PATH_CLOUD = '/2.0'
DEFAULT_API_PATH_ONPREM = '/rest/api/1.0'
DEFAULT_API_SUBDOMAIN_PREFIX = 'api'
DEFAULT_API_URL_CLOUD = 'https://api.bitbucket.org/2.0'
DEFAULT_DOMAIN = 'bitbucket.org'
DEFAULT_ENV_TOKEN_NAME = 'BITBUCKET_TOKEN'
commit_hash_url(commit_hash: str) str[source]
compare_url(from_rev: str, to_rev: str) str[source]

Get the Bitbucket comparison link between two version tags. :param from_rev: The older version to compare. :param to_rev: The newer version to compare. :return: Link to view a comparison between the two versions.

create_or_update_release(tag: str, release_notes: str, prerelease: bool = False) int | str[source]

Create or update a release for the given tag in a remote VCS, attaching the given changelog, if supported

create_release(tag: str, release_notes: str, prerelease: bool = False, assets: list[str] | None = None) int | str[source]

Create a release in a remote VCS, if supported

Which includes uploading any assets as part of the release

get_changelog_context_filters() tuple[Callable[..., Any], ...][source]

Return a list of functions that can be used as filters in a Jinja2 template

ex. filters to convert text to URLs for issues and commits

pull_request_url(pr_number: str | int) str[source]
remote_url(use_token: bool = True) str[source]

Get the remote url including the token for authentication if requested

upload_dists(tag: str, dist_glob: str) int[source]

Upload built distributions to a release on a remote VCS that supports such uploads