Bitbucket Pipelines
You can use the Phase CLI to effortlessly inject or expose secret inside your CI pipelines or jobs.
Prerequisites
- Have signed up for the Phase Console and created an application.
PHASE_SERVICE_TOKEN.
If you are using a Self-Hosted instance of the Phase Console, you may supply
PHASE_HOST environment variable with your URL (https://<HOST>).
For detailed cli install options, please see: Installation
Setting PHASE_SERVICE_TOKEN:
- Go to your Bitbucket repository.
- Click on
Repository settings. - Under
Pipeline, selectEnvironment variables. - Add
PHASE_SERVICE_TOKENand set its value.
Example:
image: atlassian/default-image:2
pipelines:
default:
- step:
name: Prepare
script:
- curl -fsSL https://pkg.phase.dev/install.sh | bash
- export $(phase secrets export --app "my application name" --env prod DOCKERHUB_USERNAME DOCKERHUB_TOKEN | xargs)
- step:
name: Build and Push
script:
- docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_TOKEN
- docker build -t my-image .
- docker push my-image:latest