Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ogrodnek/code-pipeline-slack
Slack bot for code pipeline deployments
https://github.com/ogrodnek/code-pipeline-slack
aws slack slackbot
Last synced: 2 months ago
JSON representation
Slack bot for code pipeline deployments
- Host: GitHub
- URL: https://github.com/ogrodnek/code-pipeline-slack
- Owner: ogrodnek
- License: apache-2.0
- Created: 2018-06-15T18:29:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-29T19:52:05.000Z (over 3 years ago)
- Last Synced: 2023-04-13T12:05:11.225Z (almost 2 years ago)
- Topics: aws, slack, slackbot
- Language: Python
- Size: 60.5 KB
- Stars: 97
- Watchers: 6
- Forks: 53
- Open Issues: 10
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
Code Pipeline Slack Bot
=======================This bot will notify you of CodePipeline progress (using [CloudWatch Events](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html)).
We attempt to provide a unified summary, by pulling together multiple events, as well as information obtained by the API into a single message view.
![Build](build.gif)
## Launch
| us-east-1 | us-west-2 |
| --------- | --------- |
| [![Launch](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=CodePipelineSlackNotifier&templateURL=https://s3.amazonaws.com/code-pipeline-slack-us-east-1/template.yml) | [![Launch](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/new?stackName=CodePipelineSlackNotifier&templateURL=https://s3-us-west-2.amazonaws.com/code-pipeline-slack-us-west-2/template.yml) |## Configuration / Customization
No configuration is necessary per pipeline. As part of the CF Stack, we subscribe to all CodePipeline and CodeBuild events (using [CloudWatch Events](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html)).
When creating the CloudFormation stack, you can customize:
- `SlackChannel` (defaults to `builds`).
- `SlackBotName` (defaults to `PipelineBuildBot`).
- `SlackBotIcon` (defaults to `:robot_face:` π€ ).Additionally, you must provide both a `SlackOAuthAccessToken` and a `SlackBotUserOAuthAccessToken`, (see [BotUsers](https://api.slack.com/bot-users) for creating a slack bot user with an OAuth token). If you have the legacy integration token, just add that token to both fields. It is required to add the permission scope 'Access userβs public channels' (channels:history).
## How it works
We utilize [CloudWatch Events](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html) for CodePipline and CodeBuild to get notified of all status changes.
Using the notifications, as well as using the CodePipeline APIs, we are able to present a unified summary of your Pipeline and Build status.
### IAM permissions
As part of the deployment, we create an IAM policy for the bot lambda function of:
```
Policies:
- AWSLambdaBasicExecutionRole
- Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- 'codepipeline:Get*'
- 'codepipeline:List*'
Resource: '*'
- Effect: Allow
Action:
- 'codebuild:Get*'
Resource: '*'
```So we can retrieve information about all pipelines and builds. See [template.yml](https://github.com/ogrodnek/code-pipeline-slack/blob/master/template.yml) for more detail.