Skip to content

Commit

Permalink
remove readme section for manual instrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kc-dot-io committed Sep 25, 2020
1 parent dc4ce91 commit 65f0463
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 47 deletions.
36 changes: 0 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,6 @@ dashboard.
4. You're done! Delivery & LifeCycle Metrics can now be viewed on the Metrics
Dashboard.

## Manually Instrument Pipelines using the CTO.ai Action

In addition to the drop-in Agent, you can manually instrument your GitHub
action workflows with specific LifeCycle events that you specify. For example,
if you have a GitHub workflow that deploys your application to Azure, you could
add steps to this workflow that use the CTO.ai Action (cto-ai/action) to store
metrics. The CTO.ai Action will store the event information that you specify,
and those metrics can then be visible on the CTO.ai Delivery Metrics Dashboard.

The CTO.ai steps that you can add to your workflows look like this:

```
- name: Report Build Succeeded
if: ${{ success() }}
uses: cto-ai/action@v1-beta
id: ctoai-build-succeeded
with:
team_id: ${{ secrets.CTOAI_TEAM_ID }}
token: ${{ secrets.CTOAI_EVENTS_API_TOKEN }}
stage: "Build"
status: "Succeeded"
change-id: "your-change-id1"
pipeline-id: "your-pipeline-id1"
- name: Report Build Failed
if: ${{ failure() }}
uses: cto-ai/action@v1-beta
id: ctoai-build-failed
with:
team_id: ${{ secrets.CTOAI_TEAM_ID }}
token: ${{ secrets.CTOAI_EVENTS_API_TOKEN }}
stage: "Build"
status: "Failed"
change-id: "your-change-id1"
pipeline-id: "your-pipeline-id1"
```

See a live example of this instrumentation in the [deployment-action-example](https://github.com/cto-ai/deployment-action-example)
repo, which instruments an Azure deployment pipeline.

Expand Down
25 changes: 14 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,21 @@ try {
core.setFailed(err.message);
}

function mapEventsByRepo(github) {
function mapEventsByFeature(github) {

return {
'team_id': `${CTOAI_EVENTS_TEAM_ID}`,
'pipeline_id': `${process.env.GITHUB_REPOSITORY}`,
'stage': `${snakeToTitleCase(get(github, ['context', 'eventName']))}`,
'status': `${snakeToTitleCase(get(github, ['context', 'payload', 'action'])) || 'Succeeded'}`,
'change_id': `${github.context.sha}`,
'stage_ref': `${process.env.GITHUB_REF.replace('refs/heads/','')}`,
'custom': github
}

// console.log('API URL:', CTOAI_EVENTS_API_URL)
// console.log('team_id', CTOAI_EVENTS_TEAM_ID);
// console.log('pipeline_id:', process.env.GITHUB_REPOSITORY)
// console.log('stage:', snakeToTitleCase(get(github, ['context', 'eventName'])))
// console.log('status:', snakeToTitleCase(get(github, ['context', 'payload', 'action'])) || 'Success')
// console.log('change_id:', github.context.sha)
// console.log('stage_ref:', process.env.GITHUB_REF.replace('refs/heads/',''))
// console.log(process.env);
}

function mapEventsByRepo(github) {

return {
'team_id': `${CTOAI_EVENTS_TEAM_ID}`,
Expand Down Expand Up @@ -108,8 +113,6 @@ function isMatchedEvent (github) {
}
];

// Defines the HTTP request body to be used by the event with the matching
// name.
const event_bodies = {
"Change Initiated" : {
'stage': `Change`,
Expand Down

0 comments on commit 65f0463

Please sign in to comment.