Bitbucket Pipes
How to use Bitbucket Pipes to create a CI/CD pipeline for your Kestra flows.
Set Up a Bitbucket Pipe
With the Kestra Docker image and CLI, you can validate and deploy flows from Bitbucket repositories through Bitbucket Pipes.
For flows managed via CI/CD, add the system.readOnly label set to "true" so the UI editor is disabled and production configurations stay immutable. This is especially recommended for critical production flows:
labels:
system.readOnly: true
Here is a basic pipeline:
image: kestra/kestra
pipelines:
default:
- step:
name: 'Validate Kestra flows'
deployment: staging
script:
- /bin/sh /app/kestra flow validate flows/ --server $SERVER --tenant $TENANT --user $KESTRA_USER:$KESTRA_PASSWORD
- step:
name: 'Deploy Kestra flows'
deployment: production
script:
- echo $SERVER
- echo $KESTRA_USER
- echo $KESTRA_PASSWORD
- /bin/sh /app/kestra flow namespace update dev flows/ --server=$SERVER --tenant=$TENANT --user=$KESTRA_USER:$KESTRA_PASSWORD
Variables such as $SERVER, $KESTRA_USER, $KESTRA_PASSWORD, and optionally $TENANT (for multi-tenant environments) are set in the Bitbucket variable configuration:

If you're using Kestra Enterprise Edition, you can replace --user $KESTRA_USER:$KESTRA_PASSWORD with the --api-token option to authenticate with a service account API token.
This example uses the Kestra CLI to:
- Validate flows contained in the
flows/directory of the repository. - Deploy flows into the
company.teamnamespace of your Kestra instance.
Was this page helpful?