Bitbucket Cloud

kind: bitbucket

Description

The Bitbucket Cloud scm plugin is used to manage git repositories hosted on Bitbucket Cloud, depending on the stage, it can be used for different purposes

source: Retrieve data from a git repository, such as a file content

condition: Ensure data exist on a git repository, such as a file content

target: Ensure data is up to date on a git repository

Parameters

Name Type Description Required
branch string

“branch” defines the git branch to work on.

compatible:

  • scm

default: main

remark: depending on which resource references the Bitbucket Cloud scm, the behavior will be different.

If the scm is linked to a source or a condition (using scmid), the branch will be used to retrieve file(s) from that branch.

If the scm is linked to target then Updatecli creates a new “working branch” based on the branch value. The working branch created by Updatecli looks like “updatecli_”. The working branch can be disabled using the “workingBranch” parameter set to false.

commitmessage object

“commitMessage” is used to generate the final commit message.

compatible:

  • scm

remark: it’s worth mentioning that the commit message settings is applied to all targets linked to the same scm.

    body string

body defines the commit body of the commit message as defined by the conventional commit specification. More information on -> https://www.conventionalcommits.org/en/

default: none

    deprecatedtitle string DeprecatedTitle is deprecated and will be ignored. The commit title is now always generated from the target name or description.
    footers string

footers defines the footer of the commit message as defined by the conventional commit specification. More information on -> https://www.conventionalcommits.org/en/

default: none

    hidecredit boolean

hideCredit defines if updatecli credits should be displayed inside commit message body

please consider sponsoring the Updatecli project if you want to disable credits. -> https://github.com/updatecli/updatecli

default: false

    scope string

scope defines the scope of the commit message as defined by the conventional commit specification. More information on -> https://www.conventionalcommits.org/en/

default: none

    squash boolean

squash defines if the commit should be squashed

default: false

important: if squash is set to true, then it’s highly recommended to set the commit body to a meaningful value as all other commit information will be lost during the squash operation.

if body is not set, then the commit title/message will be generated based on the most recent commit message of the squashed commits. The commit title is always generated from the target name or description.

    title string Title is the parsed commit message title (not configurable via YAML). The title is automatically generated from the target name or description.
    type string

type defines the type of commit message such as “chore”, “fix”, “feat”, etc. as defined by the conventional commit specification. More information on -> https://www.conventionalcommits.org/en/

default:

  • chore
depth integer

Depth defines the depth used when cloning the git repository.

Default: disabled (full clone)

Remark: When using a shallow clone (depth greater than 0), Updatecli is not able to retrieve the full git history. This may cause some issues when Updatecli tries to push changes to the remote repository. In that case, you may need to set the force option to true to force push changes to the remote repository.

directory string

“directory” defines the local path where the git repository is cloned.

compatible:

  • scm

remark: Unless you know what you are doing, it is recommended to use the default value. The reason is that Updatecli may automatically clean up the directory after a pipeline execution.

default: The default value is based on your local temporary directory like: (on Linux) /tmp/updatecli/bitbucket//

email string

“email” defines the email used to commit changes.

compatible:

  • scm

default: default set to your global git configuration

force boolean

“force” is used during the git push phase to run git push --force.

compatible:

  • scm

default: true

remark: When force is set to true, Updatecli also recreate the working branches that diverged from their base branch.

gpg object

“gpg” specifies the GPG key and passphrased used for commit signing

compatible:
	* scm
    passphrase string passphrase defines the gpg passphrase used to sign the commit message
    signingkey string

signingKey defines the gpg key used to sign the commit message

	default:
		none
owner string

“owner” defines the owner of a repository.

compatible:
	* scm
password string

“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

repository string

repository specifies the name of a repository for a specific owner.

compatible:
	* scm
submodules boolean

“submodules” defines if Updatecli should checkout submodules.

compatible: * scm

default: true

token string

“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

user string

“user” specifies the user associated with new git commit messages created by Updatecli

compatible:
	* scm
username string “username” specifies the username used to authenticate with Bitbucket Cloud API
workingbranch boolean

“workingBranch” defines if Updatecli should use a temporary branch to work on. If set to true, Updatecli create a temporary branch to work on, based on the branch value.

compatible: * scm

default: true

workingbranchprefix string

WorkingBranchPrefix defines the prefix used to create a working branch.

compatible:

  • scm

default: updatecli

remark: A working branch is composed of three components:

  1. WorkingBranchPrefix
  2. Target Branch
  3. PipelineID

If WorkingBranchPrefix is set to ‘’, then the working branch will look like “_”.

workingbranchseparator string

WorkingBranchSeparator defines the separator used to create a working branch.

compatible:

  • scm

default: “_”

CommitMessage

Updatecli uses conventional commits as describe on www.conventionnalcommits.org.
The goal is to add human and machine readable meaning to commit messages

By default, Updatecli generates a commit message using the default type "chore" and split long title message into the body like:


Author: olblak <updatecli@updatecli.io>
Date:   Tue May 4 15:41:44 2021 +0200

    chore: Update key "dependencies[0].version" from file "charts/jenkins/r...

    ... equirements.yaml"

    Made with ❤️️  by updatecli

Example

# updatecli.yaml
name: "Example with Bitbucket Cloud SCM"
pipelineid: bitbucket/scm

scms:
  bitbucket:
    kind: bitbucket
    spec:
      owner: "updatecli"
      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 }}

sources:
  source-1:
    name: "Source 1"
    kind: file
    scmid: bitbucket
    spec:
      file: README.md

conditions:
  condition-1:
    name: "Condition 1"
    kind: file
    scmid: bitbucket
    spec:
      file: README.md

targets:
  target-1:
    name: "Target 1"
    kind: file
    scmid: bitbucket
    spec:
      file: README.md
Top