Skip to content

bb build

Report and read build statuses, and require builds before a merge

10 commands.

bb build delete
Delete repository-scoped build status by key
bb build get
Get repository-scoped build status by key
bb build required
Create, list, update and delete the builds a merge requires (4 commands)
bb build set
Set repository-scoped build status for a commit
bb build status
Report and read the build statuses of a commit (3 commands)

bb build delete

Delete repository-scoped build status by key

bb build delete <commit> [flags]
# Remove one build status from a commit
bb build delete a1b2c3d --key ci --repo PROJ/repo
--key string
Build status key
-y, --yes
Confirm without being asked; applies only when the target is named with --repo PROJECT/slug

Inherited from bb build:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)

Output with --json, where ? marks a field that can be absent
data
  status        string  Outcome of the command.
  repository    object
    projectKey  string  Project key the repository belongs to.
    slug        string  Repository slug.
  commit        string  Commit the build status was set on or removed from.
  key           string  Build key that was set or removed.

bb build get

Get repository-scoped build status by key

bb build get <commit> [flags]
# One build status of a commit, by key
bb build get a1b2c3d --key ci --repo PROJ/repo
--key string
Build status key

Inherited from bb build:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Runs as usual: this command changes nothing, so there is nothing to hold back

Output with --json, where ? marks a field that can be absent
data
  key?          string                                          Build key, unique per commit.
  state?        SUCCESSFUL|FAILED|INPROGRESS|CANCELLED|UNKNOWN
  url?          string                                          Link to the build in the reporting system.
  name?         string                                          Display name of the build.
  description?  string                                          Longer description the reporter attached.
  ref?          string                                          Ref the build ran against, when the reporter said.
  parent?       string                                          Key of the build that triggered this one.
  buildNumber?  string                                          Reporter's own build number.
  duration?     integer                                         How long the build took, in milliseconds.
  createdDate?  integer                                         When the status was first reported, in milliseconds
                                                                since the epoch.
  updatedDate?  integer                                         When the status was last updated, in milliseconds since
                                                                the epoch.
  repository?   object                                          Repository the build belongs to.
    projectKey  string                                          Project key the repository belongs to.
    slug        string                                          Repository slug.
  testResults?  object                                          Test tally, when the reporter attached one.
    successful  integer                                         Tests that passed.
    failed      integer                                         Tests that failed.
    skipped     integer                                         Tests that were skipped.

bb build required

Create, list, update and delete the builds a merge requires

create
Create required build merge check
delete
Delete required build merge check
list
List required build merge checks
update
Update required build merge check

bb build required create

Create required build merge check

bb build required create [flags]
# Require the build with key ci before anything merges into main
bb build required create --repo PROJ/repo \
  --body '{"buildParentKeys":["ci"],"refMatcher":{"id":"refs/heads/main","type":{"id":"BRANCH"}}}'
--body string
Raw JSON payload for required build merge check

Inherited from bb build:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Predicts the outcome from what it can read, without changing anything (predicted)

Output with --json, where ? marks a field that can be absent
data
  id?                     integer                                                            Check identifier, which update and
                                                                                             delete address.
  buildParentKeys?        list of string                                                     Build keys that must be green before a
                                                                                             pull request can merge.
  refMatcher?             object                                                             Which target branches the check is
                                                                                             enforced on.
    id?                   string                                                             Matcher value: a branch name, a pattern,
                                                                                             or a model branch id depending on type.
    displayId?            string                                                             Human-readable form of the same thing.
    type?                 ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                             MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                             decides how id is read.
  exemptRefMatcher?       object                                                             Which source branches are exempt from
                                                                                             the check.
    id?                   string                                                             Matcher value: a branch name, a pattern,
                                                                                             or a model branch id depending on type.
    displayId?            string                                                             Human-readable form of the same thing.
    type?                 ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                             MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                             decides how id is read.
  requiredForPullRequest  boolean                                                            Whether the check is enforced on pull
                                                                                             requests.
  requiredForMergeQueue   boolean                                                            Whether the check is enforced on
                                                                                             merge-queue merges.

bb build required delete

Delete required build merge check

bb build required delete <required-build-id> [flags]
# By the id bb build required list prints
bb build required delete 5 --repo PROJ/repo
-y, --yes
Confirm without being asked; applies only when the target is named with --repo PROJECT/slug

Inherited from bb build:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)

Output with --json, where ? marks a field that can be absent
data
  status        string   Outcome of the command.
  repository    object
    projectKey  string   Project key the repository belongs to.
    slug        string   Repository slug.
  id            integer  Identifier of the merge check that was deleted.

bb build required list

List required build merge checks

bb build required list [flags]
# The builds a pull request needs before it can merge
bb build required list --repo PROJ/repo
--all
Return every result rather than the first --limit
--limit int
Maximum number of results to return (default 25)

Inherited from bb build:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Runs as usual: this command changes nothing, so there is nothing to hold back

Output with --json, where ? marks a field that can be absent
data                      list of object
  id?                     integer                                                            Check identifier, which update and
                                                                                             delete address.
  buildParentKeys?        list of string                                                     Build keys that must be green before a
                                                                                             pull request can merge.
  refMatcher?             object                                                             Which target branches the check is
                                                                                             enforced on.
    id?                   string                                                             Matcher value: a branch name, a pattern,
                                                                                             or a model branch id depending on type.
    displayId?            string                                                             Human-readable form of the same thing.
    type?                 ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                             MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                             decides how id is read.
  exemptRefMatcher?       object                                                             Which source branches are exempt from
                                                                                             the check.
    id?                   string                                                             Matcher value: a branch name, a pattern,
                                                                                             or a model branch id depending on type.
    displayId?            string                                                             Human-readable form of the same thing.
    type?                 ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                             MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                             decides how id is read.
  requiredForPullRequest  boolean                                                            Whether the check is enforced on pull
                                                                                             requests.
  requiredForMergeQueue   boolean                                                            Whether the check is enforced on
                                                                                             merge-queue merges.

bb build required update

Update required build merge check

bb build required update <required-build-id> [flags]
# Replace a required build: which keys, and for which branches
bb build required update 5 --repo PROJ/repo \
  --body '{"buildParentKeys":["ci","lint"],"refMatcher":{"id":"refs/heads/main","type":{"id":"BRANCH"}}}'
--body string
Raw JSON payload for required build merge check

Inherited from bb build:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Predicts the outcome from what it can read, without changing anything (predicted)

Output with --json, where ? marks a field that can be absent
data
  id?                     integer                                                            Check identifier, which update and
                                                                                             delete address.
  buildParentKeys?        list of string                                                     Build keys that must be green before a
                                                                                             pull request can merge.
  refMatcher?             object                                                             Which target branches the check is
                                                                                             enforced on.
    id?                   string                                                             Matcher value: a branch name, a pattern,
                                                                                             or a model branch id depending on type.
    displayId?            string                                                             Human-readable form of the same thing.
    type?                 ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                             MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                             decides how id is read.
  exemptRefMatcher?       object                                                             Which source branches are exempt from
                                                                                             the check.
    id?                   string                                                             Matcher value: a branch name, a pattern,
                                                                                             or a model branch id depending on type.
    displayId?            string                                                             Human-readable form of the same thing.
    type?                 ANY_REF|BRANCH|PATTERN|MODEL_BRANCH|MODEL_CATEGORY|DEFAULT_BRANCH  ANY_REF, BRANCH, PATTERN, MODEL_BRANCH,
                                                                                             MODEL_CATEGORY or DEFAULT_BRANCH, which
                                                                                             decides how id is read.
  requiredForPullRequest  boolean                                                            Whether the check is enforced on pull
                                                                                             requests.
  requiredForMergeQueue   boolean                                                            Whether the check is enforced on
                                                                                             merge-queue merges.

bb build set

Set repository-scoped build status for a commit

bb build set <commit> [flags]
# Report a passing build on a commit of this repository
bb build set a1b2c3d --repo PROJ/repo --key ci --state SUCCESSFUL \
  --url https://ci.example.com/builds/128

# From a CI job: one step of a larger build, with what Bitbucket shows beside it
bb build set "$GIT_COMMIT" --repo PROJ/repo --key ci-unit --parent ci \
  --state FAILED --name "Unit tests" --description "3 of 412 tests failed" \
  --build-number 128 --duration-ms 93000 --ref refs/heads/feature/x \
  --url https://ci.example.com/builds/128
--build-number string
Build number
--description string
Build description
--duration-ms int
Duration in milliseconds
--key string
Build status key
--name string
Build display name
--parent string
Build parent key
--ref string
Build ref
--state string
Build state (one of: SUCCESSFUL, FAILED, INPROGRESS, CANCELLED, UNKNOWN)
--url string
Build URL

Inherited from bb build:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)

Output with --json, where ? marks a field that can be absent
data
  status        string  Outcome of the command.
  repository    object
    projectKey  string  Project key the repository belongs to.
    slug        string  Repository slug.
  commit        string  Commit the build status was set on or removed from.
  key           string  Build key that was set or removed.

bb build status

Report and read the build statuses of a commit

get
Get build statuses for a commit
set
Set build status for a commit
stats
Get build status summary counts for one or more commits

bb build status get

Get build statuses for a commit

bb build status get <commit> [flags]
# The builds reported for a commit
bb build status get a1b2c3d --repo PROJ/repo

# Newest first
bb build status get a1b2c3d --repo PROJ/repo --order-by NEWEST
--all
Return every result rather than the first --limit
--limit int
Maximum number of results to return (default 25)
--order-by string
Build status ordering (one of: NEWEST, OLDEST, STATUS)

Inherited from bb build:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Runs as usual: this command changes nothing, so there is nothing to hold back

Output with --json, where ? marks a field that can be absent
data            list of object
  key?          string                                          Build key, unique per commit.
  state?        SUCCESSFUL|FAILED|INPROGRESS|CANCELLED|UNKNOWN
  url?          string                                          Link to the build in the reporting system.
  name?         string                                          Display name of the build.
  description?  string                                          Longer description the reporter attached.
  ref?          string                                          Ref the build ran against, when the reporter said.
  parent?       string                                          Key of the build that triggered this one.
  buildNumber?  string                                          Reporter's own build number.
  duration?     integer                                         How long the build took, in milliseconds.
  createdDate?  integer                                         When the status was first reported, in milliseconds
                                                                since the epoch.
  updatedDate?  integer                                         When the status was last updated, in milliseconds since
                                                                the epoch.
  repository?   object                                          Repository the build belongs to.
    projectKey  string                                          Project key the repository belongs to.
    slug        string                                          Repository slug.
  testResults?  object                                          Test tally, when the reporter attached one.
    successful  integer                                         Tests that passed.
    failed      integer                                         Tests that failed.
    skipped     integer                                         Tests that were skipped.

bb build status set

Set build status for a commit

bb build status set <commit> [flags]
# Report a build in progress, then its result
bb build status set a1b2c3d --key ci --state INPROGRESS --url https://ci.example.com/builds/128
bb build status set a1b2c3d --key ci --state FAILED --url https://ci.example.com/builds/128 \
  --name "Unit tests" --description "3 of 412 tests failed"
--build-number string
Build number
--description string
Build description
--duration-ms int
Duration in milliseconds
--key string
Build status key
--name string
Build display name
--parent string
Build parent key
--ref string
Build ref
--state string
Build state (one of: SUCCESSFUL, FAILED, INPROGRESS, CANCELLED, UNKNOWN)
--url string
Build URL

Inherited from bb build:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Predicts the outcome from what it can read, without changing anything (predicted)

Output with --json, where ? marks a field that can be absent
data
  status  string  Outcome of the command.
  commit  string  Commit the build status was set on.
  key     string  Build key that was set.

bb build status stats

Get build status summary counts for one or more commits

bb build status stats <commit>...
# How many builds passed, failed and are running, for each of two commits
bb build status stats a1b2c3d e4f5a6b

Inherited from bb build:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Runs as usual: this command changes nothing, so there is nothing to hold back

Output with --json, where ? marks a field that can be absent
data          list of object
  commit      string          Commit the tally is for, as it was given on the command line.
  successful  integer         Builds reporting SUCCESSFUL.
  failed      integer         Builds reporting FAILED.
  inProgress  integer         Builds reporting INPROGRESS.
  unknown     integer         Builds reporting UNKNOWN.
  cancelled   integer         Builds reporting CANCELLED.