Bitbucket Pipelines
This walkthrough shows you how to use CloudTruth parameters with Bitbucket Pipelines.
Prerequisites
You have a Bitbucket account.
You have created one or more CloudTruth Parameters.
You have created a CloudTruth API Access token.
Provide Bitbucket Pipelines CloudTruth Access
You can get started with Bitbucket using a starter pipeline template.
Add your generated CloudTruth API access token as a Bitbucket repository variable namedCLOUDTRUTH_API_KEY
in your Repository settings > Pipelines > Repository variables. This allows the Bitbucket repository to securely access parameters stored in CloudTruth across all deployment environments.
Configure a Bitbucket Pipeline with CloudTruth Parameters
Using the CloudTruth CLI
You can install the CLI with the following code snippet as part of a Bitbucket step in bitbucket-pipelines.yml. This will install the latest supported version and also verify the CLI is installed correctly by printing the version.
We then use the CloudTruth CLI run command to print only CloudTruth variables that can now be accessed in your pipeline.
Running this pipeline will install the CloudTruth CLI and print parameter values retrieved from CloudTruth.
Passing CloudTruth parameters across Bitbucket Pipeline steps
You can use variables across Bitbucket pipeline steps by creating an export formatted environment file and storing the file using Bitbucket artifacts. This snippet uses the CloudTruth CLI to create an export dotenv file with values pulled from CloudTruth.
Using CloudTruth parameters across Bitbucket Pipeline steps
In future pipeline steps you can source the dotenv artifact. The command source dotenv
will execute the dotenv export allowing you to reference the variables in downstream stages without the CloudTruth CLI.
The complete bitbucket-pipelines.yml passing variables between steps.
Running this pipeline will install the CloudTruth CLI and print the parameter values across multiple steps.
Last updated