The source code for the CircleCI Orb that assists CircleCI users to send workflow events to CTO.ai.
The token
input should be your CTO.ai API token. You can follow our docs to generate your API token.
Instructions for finding the CTO.ai Team ID which owns the received data can also be found in our docs.
The name which represents the event being sent, e.g. "deployment".
The state resulting from the event taking action, e.g. "failure" or "success".
The following variables are optional inputs to your Orb, which may be required by more complex builds.
The branch
field refers to the git branch name where the change occurs. When absent, the pipe will use the built-in environment variable CIRCLE_BRANCH
, exposed by CircleCI.
The commit
field refers to the commit hash representing the current change. When absent, the pipe will use the built-in environment variable CIRCLE_SHA1
, exposed by CircleCI.
The repo
field refers to the name of the repository where the change is occurring. When absent, the pipe will use the built-in environment variable CIRCLE_PROJECT_REPONAME
, exposed by CircleCI.
The environment
field refers to the environment in which the workflow is running.
The image
field refers to the OCI image name or ID associated with this event.
Create 2 new environment variables for your token
and team_id
to be passed into the job.
- Follow guide to set an environment variable in your project
- Create
CTOAI_TEAM_ID
secret using your CTO.ai-issued Team ID. - Create
CTOAI_EVENTS_API_TOKEN
secret using your CTO.ai-issued API Token.
Users can use this orb to send events to CTO.ai platform. Below is an example for the same:
version: 2.1
description: "Example showing how to send a workflow metric events to CTO.ai. Set CTOAI_EVENTS_API_TOKEN and CTOAI_TEAM_ID env vars in CircleCI settings."
orbs:
cto-ai: cto-ai/cto-ai@1.0.4
jobs:
events_example_job:
docker:
- image: cimg/base:stable
steps:
- cto-ai/event:
token: ${CTOAI_EVENTS_API_TOKEN}
team_id: ${CTOAI_TEAM_ID}
image: app78df3bl2
environment: staging
event_name: deployment
event_action: success
workflows:
events_example_workflow:
jobs:
- events_example_job
The events-orb-example
repo has an example of the Orb in use.
This section is a guide for CTO.ai team developers to contribute within the project.
circleci orb publish ctoai_events_orb.yml cto-ai/cto-ai@x.y.z