Bitbucket Cloud Pull Request

kind: bitbucket/pullrequest

Description

The action section describes the Bitbucket Cloud Pull Request that updatecli is expected to open (or update) when a target is modified.

Parameters

NameTypeDescriptionRequired
bodystringBody defines the Bitbucket pullrequest body
ownerstringOwner specifies repository owner
passwordstring

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

The “password” should be app password with “pullrequest:write” scope.

“token” and “password” are mutually exclusive

remark: A password 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_PASSWORD"}} to retrieve the token from the environment variable BITBUCKET_PASSWORD or {{ .bitbucket.password }} 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

repositorystringRepository specifies the name of a repository for a specific owner
sourcebranchstringSourceBranch specifies the pullrequest source branch
targetbranchstringTargetBranch specifies the pullrequest target branch
titlestringTitle defines the Bitbucket pullrequest title.
tokenstring

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

The “token” is a repository or project access token with “pullrequest:write” scope.

“token” and “password” are mutually exclusive

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

usernamestring“username” specifies the username used to authenticate with Bitbucket Cloud API

Example

# updatecli.yaml
# updatecli diff --config updatecli.yaml
#
name: Show Bitbucket Cloud pipeline example

# Sources are responsible to fetch information from third location such as npm registry.
sources:
  updatecli:
    name: Get latest axios version
    kind: npm
    spec:
      name: axios

# Targets are responsible to update targeted files such as a yaml file.
targets:
  npm:
    name: Update e2e test file
    kind: yaml
    sourceid: updatecli
    scmid: bitbucket
    spec:
      file: e2e/updatecli.d/success.d/npm.yaml
      key: conditions.axios.spec.version

###

# Actions such as gitlab/mergerequest is triggered if a target is updated.
actions:
  default:
    title: Bump axios version
    kind: bitbucket/pullrequest
    scmid: bitbucket

scms:
  bitbucket:
    kind: bitbucket
    spec:
      owner: "olblak"
      repository: "updatecli"
      branch: main
      # {{ if (env "BITBUCKET_TOKEN") }}
      token: '{{ env "BITBUCKET_TOKEN" }}'
      # {{ else if (and (env "BITBUCKET_USER") (env "BITBUCKET_APP_PASSWORD")) }}
      username: '{{ env "BITBUCKET_USER" }}'
      password: '{{ env "BITBUCKET_APP_PASSWORD" }}'
      # {{ end }}
Top