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_IDThe ID of the Team on the CTO.ai platform to associate with this event. This environment variable corresponds to the
team_idfield in thedeploymentevent schema.$EVENT_NAMEFor deployment events, this value must always be
deployment. This environment variable corresponds to theevent_namefield in thedeploymentevent schema.$EVENT_ACTIONThis should be one of the Deployment Lifecycle States defined on the Event Types page. This environment variable corresponds to the
event_actionfield in thedeploymentevent schema.$BRANCHThe name of the branch that triggered the deployment. This environment variable corresponds to the
branchfield in thedeploymentevent schema.This environment variable is optional and defaults to the value of
$BITBUCKET_BRANCHif not specified.$COMMITThe SHA hash of the commit that triggered the deployment. This environment variable corresponds to the
commitfield in thedeploymentevent schema.This environment variable is optional and defaults to the value of
$BITBUCKET_COMMITif not specified.$REPOThe name of the repository that triggered the deployment. This environment variable corresponds to the
repofield in thedeploymentevent schema.This environment variable is optional and defaults to the value of
$BITBUCKET_REPO_FULL_NAMEif not specified.$ENVIRONMENTA string that uniquely represents the environment that the deployment is targeting. This environment variable corresponds to the
environmentfield in thedeploymentevent schema.This environment variable is optional and defaults to the value of
$CI_ENVIRONMENT_NAMEif not specified.$IMAGEOptionally provide an identifier for the container image that is associated with the current deployment. This environment variable corresponds to the
imagefield in thedeploymentevent schema.