An AWS SAR component that sends CodePipeline notifications to AWS Chatbot, which itself can publish messages to Slack, etc.
You'll need to deploy this once per CodePipeline you wish to receive notitications for.
If you want to integrate Chatbot with CodeBuild instead then please see the CodeBuild version of this component.
If you deploy your CodePipeline infrastructure using CloudFormation, then you can include the Chatbot Notifier SAR component in the same template as your CodePipeline. First, make sure you've included the SAM transform in your CloudFormation template - we normally put it as the second line:
Transform: AWS::Serverless-2016-10-31
Next, in the Resources
section of your template, add a SAR resource as follows:
ChatbotNotifier:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:073101298092:applications/codepipeline-chatbot
SemanticVersion: 1.0.1
Parameters:
CodePipeline: 'YOUR_CODEPIPELINE_NAME'
This SAR has one required parameter: CodePipeline
. Typically you'll set this to !Ref YOUR_CODEPIPELINE_RESOURCE
(not quoted inside a string!), where YOUR_CODEPIPELINE_RESOURCE
is the logical resource name of the AWS::CodePipeline::Pipeline
resource that is also in this CloudFormation template.
For an example of configuring Chatbot Notifier with CloudFormation, see the ChatbotNotifier
resource in this template.
If you want to deploy without CloudFormation you can do so from the Serverless Application Repository browser here.
This SAR app doesn't actually publish notifications to Slack, etc., it merely puts them in a place AWS Chatbot can use them. Therefore to publish the actual notifications to Slack see the AWS Chatbot documentation. You'll need to know the SNS topic name to connect to Chatbot - that's available in the SNSTopicName
CloudFormation Output value of the SAR component.
Apart from the required CodePipeline
parameter, there are other optional parameters to the resource. Here's the full list of parameters.
Name | Required | Default | Description |
---|---|---|---|
CodePipeline |
Yes | n/a | The name of the CodePipeline to capture notifications from. Equal to the "Ref" value of the AWS::CodePipeline::Pipeline resource. |
NotificationRuleName |
No | Same value as CodePipeline |
Set if you wish to override the name given to the CodeStar Notification Rule - this is necessary if the CodePipeline argument is longer than 64 characters. |
DetailType |
No | FULL | The level of detail to include in the notifications for this resource. (see AWS documentation). |
If you'd like further customization, e.g. changing the name of the SNS topic or customizing which events are published, then I recommend replacing the SAR with the plain resources in the SAR's source template (see here) - the SAR has no Lambda components, just plain CloudFormation resources which you can drop into a regular CloudFormation template.
This component supersedes my previous SAR app Code Pipeline Slack Notifier, which is no longer maintained, and deprecated.