BitBucket Repository Tools
Usage
bitbucketContainer envFile [ extraArgs ... ]
Run the default build container for build testing on BitBucket
Arguments
envFile- File. Required. One or more environment files which are suitable to load for docker; must be validextraArgs ...- Arguments. Optional. The first non-file argument tobitbucketContaineris passed directly through todocker runas arguments
Return codes
1- If already inside docker, or the environment file passed is not valid0- SuccessAny-docker runerror code is returned if non-zero
Usage
isBitBucketPipeline
Are we currently in the BitBucket pipeline?
Arguments
- none
Return codes
0- is BitBucket pipeline1- Not a BitBucket pipeline
Usage
bitbucketGetVariable [ varName ] [ defaultValue ]
Fetch a value from the pipelines YAML file
Assumes current working directory is project root.
Simple get value of a variable from the bitbucket-pipelines.yml file. It's important to note that
this does not parse the YML. This is useful if
you have a database container as part of your build configuration which requires a root password
required in other scripts; this means you do not have to replicate the value which can lead to errors.
An example bitbucket-pipelines.yml file may have a header which looks like this:
definitions:
caches:
services:
mariadb:
variables:
On this file, the value of $(bitbucketGetVariable MARIADB_ROOT_PASSWORD) is super-secret; it uses grep and sed to extract the value.
Arguments
varName- Name of the value to extract frombitbucket-pipelines.ymldefaultValue- Value if not found in pipelines
Examples
MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD:-$(bitbucketGetVariable MARIADB_ROOT_PASSWORD not-in-bitbucket-pipelines.yml)}
Return codes
0- Success1- Environment error2- Argument error
Usage
bitbucketPRNewURL [ organization ] [ repository ]
Compute the URL to create a new PR
Arguments
organization- String. Organization name.repository- String. Repository name.
Return codes
0- Success1- Environment error2- Argument error