Welcome to your first Atomist event handler! This handler is a TypeScript Node app that receives and responds to failed build events.
This README walks you through:
- running the handler
- extending the handler so that it sends a Slack DM to the person who broke the build
Clone this project repository locally and change into the project directory.
$ git clone https://github.com/atomisthqa/failed-build-handler.git
$ cd failed-build-handler
You must have Node and NPM to install your handler's dependencies:
$ npm install
Next, create an Atomist API token. Note your API token!
Run your event handler app, replacing ATOMIST_TOKEN with your API token:
$ npm run serve -- ATOMIST_TOKEN
You'll see this output:
Handler starting, type Ctrl-C to exit.
Connected and listening for events of type: BuildFailed
When you're ready to exit the app, type Ctrl-C.
Once your app is running and listening for events, you can send a test event to see it in action.
Now that you have everything working, let's change the handler to send a Slack DM to the committer who broke the build.
First, create a Slack API token that Slack needs to accept and display your message.
Change the handle function in src/Handler.ts to be the following:
export function handle(results: Result[]) {
send(results);
}Ctrl-C to exit any currently running instances of this app.
Start the app. Provide the Slack API token after your Atomist token on the command line.
$ npm run serve -- ATOMIST_TOKEN SLACK_TOKEN
Once the app is listening, send another event to test it, and see the resulting message notification in Slack.
If that worked, congratulations! Your first event handler is now live.