On this page
Stash Branch
| source | condition | target |
|---|---|---|
✔ | ✔ | ✗ |
Description
The stash/branch resource queries the branches of a repository hosted on Bitbucket Server (the product formerly called Stash and now Bitbucket Data Center).
- source
Returns the branch matching
versionfilter, which is how you follow a release branch such as the highestrelease/x.y.- condition
Tests that
branchexists in the repository.- target
Not supported - a target fails with
target not supported for the plugin stash branch. Say so on the issue tracker if you would use one.
Note | An scm is accepted but ignored, logging scm not supported, ignoring. The lookup always goes to the Bitbucket Server API. |
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
| branch | string | “branch” defines the branch name to check. compatible:
default: the output of the associated source. | |
| owner | string | “owner” defines the repository owner. compatible:
remark:
| |
| password | string | “password” defines the credential used to authenticate with the Bitbucket Server API. remark:
| |
| repository | string | “repository” defines the repository name. compatible:
remark:
| |
| token | string | “token” defines the credential used to authenticate with the Bitbucket Server API. remark:
| |
| url | string | “url” defines the Bitbucket Server url. remark:
example:
| |
| username | string | “username” defines the username used to authenticate with the Bitbucket Server API. remark:
| |
| versionfilter | object | “versionfilter” defines the version pattern and its kind, such as “regex”, “semver” or “latest”. compatible:
default: latest | |
| kind | string | “kind” defines the versioning scheme used to select a version. default: latest remark:
example:
| |
| pattern | string | “pattern” defines the version pattern, according to “kind”. default:
remark:
example:
| |
| regex | string | “regex” defines the regular expression extracting the version from each entry. remark:
example:
| |
| replaceall | object | “replaceall” applies a regular expression replacement to each version before filtering. remark:
example: turns “curl-8_15_0” into “curl-8.15.0”. | |
| strict | boolean | “strict” enforces strict semantic versioning rules when parsing versions. default: false remark:
|
url, owner and repository are mandatory.
urlThe Bitbucket Server instance, e.g.
https://stash.example.com. This is a self-hosted product, so there is no default.ownerThe project key or user the repository belongs to.
branchCondition only - the branch being checked.
versionfilterSource only. See the "Version Filtering" page.
Authentication
Credentials are either a token or a username and password pair, both sensitive, so read them from the environment or a SOPS file rather than writing them into the manifest:
spec:
url: https://stash.example.com
token: '{{ requiredEnv "BITBUCKET_TOKEN" }}'
owner: PROJECTKEY
repository: myrepopassword must be combined with username. Reading a public repository needs no credential at all.
Example
# updatecli.yaml
sources:
latestReleaseBranch:
name: Get the latest release branch
kind: stash/branch
spec:
url: https://stash.example.com
token: '{{ requiredEnv "BITBUCKET_TOKEN" }}'
owner: PROJECTKEY
repository: myrepo
versionfilter:
kind: regex
pattern: 'release/.*'Links
The
stashscm - to clone and push