Integrate Bitbucket Pipelines with CTO.ai
The CTO.ai Bitbucket Pipe lets you integrate your existing development workflows from Bitbucket Pipelines with the CTO.ai platform. However, you choose to make Bitbucket Pipelines part of your development process, our Pipe gives you granular control of the events collected by the CTO.ai platform and allows you to send Insights Events at the points in your existing workflows where it makes the most sense.
Before you begin, you may want to review our documentation on Insights Events to better understand the concepts implemented by our platform.
Bitbucket Pipelines Pipe
This integration is available as a public repository on GitHub.
To make use of this Pipe, you can add the following snippet in under the script
section of your bitbucket-pipelines.yml
file:
script:
- pipe: docker://registry.cto.ai/official_images/events-pipe:v0.0.1
variables:
TOKEN: "${CTOAI_EVENTS_API_TOKEN}"
TEAM_ID: "${CTOAI_TEAM_ID}"
EVENT: "deployment"
EVENT_ACTION: success
The above snippet expects that you have set environment variables for CTOAI_EVENTS_API_TOKEN
and CTOAI_TEAM_ID
in your Bitbucket Pipelines settings. Instructions for finding these values can be found on our Collect Events via API page.
Deployment Events
For more information on the expected fields for Deployment Events, please see the Event Schema Reference page.
$TOKEN
- Your API token for the CTO.ai platform.
$TEAM_ID
The ID of the Team on the CTO.ai platform to associate with this event. This environment variable corresponds to the
team_id
field in thedeployment
event schema.$EVENT_NAME
For deployment events, this value must always be
deployment
. This environment variable corresponds to theevent_name
field in thedeployment
event schema.$EVENT_ACTION
This should be one of the Deployment Lifecycle States defined on the Event Types page. This environment variable corresponds to the
event_action
field in thedeployment
event schema.$BRANCH
The name of the branch that triggered the deployment. This environment variable corresponds to the
branch
field in thedeployment
event schema.This environment variable is optional and defaults to the value of
$BITBUCKET_BRANCH
if not specified.$COMMIT
The SHA hash of the commit that triggered the deployment. This environment variable corresponds to the
commit
field in thedeployment
event schema.This environment variable is optional and defaults to the value of
$BITBUCKET_COMMIT
if not specified.$REPO
The name of the repository that triggered the deployment. This environment variable corresponds to the
repo
field in thedeployment
event schema.This environment variable is optional and defaults to the value of
$BITBUCKET_REPO_FULL_NAME
if not specified.$ENVIRONMENT
A string that uniquely represents the environment that the deployment is targeting. This environment variable corresponds to the
environment
field in thedeployment
event schema.This environment variable is optional and defaults to the value of
$CI_ENVIRONMENT_NAME
if not specified.$IMAGE
Optionally provide an identifier for the container image that is associated with the current deployment. This environment variable corresponds to the
image
field in thedeployment
event schema.