sourceconditiontarget

Description

The stash/tag resource queries the tags of a repository hosted on Bitbucket Server - the product formerly called Stash and now Bitbucket Data Center. It is the usual way to track releases of an internally hosted dependency.

source

Returns the tag matching versionfilter.

condition

Tests that tag exists in the repository.

target

Not supported - a target fails with target not supported for the plugin Stash Tags. Say so on the issue tracker if you would use one.

Note
An scm is accepted but ignored, logging scm not supported, ignored. The lookup always goes to the Bitbucket Server API.

Parameters

NameTypeDescriptionRequired
ownerstring[S][C] Owner specifies repository owner
passwordstring

“password” specifies the credential used to authenticate with Bitbucket Server API, it must be combined with “username”

remark: A token is a sensitive information, it’s recommended to not set this value directly in the configuration file but to use an environment variable or a SOPS file.

The value can be set to {{ requiredEnv "BITBUCKET_TOKEN"}} to retrieve the token from the environment variable BITBUCKET_TOKEN or {{ .bitbucket.token }} to retrieve the token from a SOPS file.

For more information, about a SOPS file, please refer to the following documentation: https://github.com/getsops/sops

repositorystring[S][C] Repository specifies the name of a repository for a specific owner
tagstring[S] Tag defines the Bitbucket tag .
tokenstring

“token” specifies the credential used to authenticate with Bitbucket Server API

remark: A token is a sensitive information, it’s recommended to not set this value directly in the configuration file but to use an environment variable or a SOPS file.

The value can be set to {{ requiredEnv "BITBUCKET_TOKEN"}} to retrieve the token from the environment variable BITBUCKET_TOKEN or {{ .bitbucket.token }} to retrieve the token from a SOPS file.

For more information, about a SOPS file, please refer to the following documentation: https://github.com/getsops/sops

urlstring“url” specifies the default stash url in case of Bitbucket Server
usernamestring“username” specifies the username used to authenticate with Bitbucket Server API
versionfilterobject[S][C] VersionFilter provides parameters to specify version pattern and its type like regex, semver, or just latest.
    kindstringspecifies the version kind such as semver, regex, or latest
    patternstringspecifies the version pattern according the version kind for semver, it is a semver constraint for regex, it is a regex pattern for time, it is a date format
    regexstringspecifies the regex pattern, used for regex/semver and regex/time. Output of the first capture group will be used.
    replaceallobjectreplaceAll applies a regex replacement to version strings before filtering. This is useful for transforming versions (e.g., curl-8_15_0 to curl-8.15.0) before regex extraction.
    strictbooleanstrict enforce strict versioning rule. Only used for semantic versioning at this time

url, owner and repository are mandatory.

url

The Bitbucket Server instance, e.g. https://stash.example.com. This is a self-hosted product, so there is no default.

owner

The project key or user the repository belongs to.

tag

Condition only - the tag being checked.

versionfilter

Source only. kind: semver is the usual choice for release tags. 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:

spec:
  url: https://stash.example.com
  token: '{{ requiredEnv "BITBUCKET_TOKEN" }}'
  owner: PROJECTKEY
  repository: myrepo

password must be combined with username. Reading a public repository needs no credential at all.

Example

# updatecli.yaml
sources:
  latestTag:
    name: Get the latest release tag
    kind: stash/tag
    spec:
      url: https://stash.example.com
      token: '{{ requiredEnv "BITBUCKET_TOKEN" }}'
      owner: PROJECTKEY
      repository: myrepo
      versionfilter:
        kind: semver