question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(@aws-cdk/aws-codepipeline): CodePipeline notifications

See original GitHub issue

❓ General Issue

The Question

Hello, could you please provide an example, if CDK supports that, how to send notification in case CodePipeline succeeds/fails?

I was trying to come up with a solution via @aws-cdk/aws-codepipeline-actions, but only usage of email was in ManualApprovalAction.

I believe it could be solved by creating Lambda function + SNS topic, but it seems unnecessarily complicated and hopefully could come out-of-the-box in the CDK.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jakubgrubercommented, Apr 22, 2021

Thank you for help, have a nice day!

1reaction
skinny85commented, Apr 22, 2021

Sure. Here’s a simple example.

import { App, Stack } from '@aws-cdk/core';
import codepipeline = require('@aws-cdk/aws-codepipeline');
import event_targets = require('@aws-cdk/aws-events-targets');
import sns = require('@aws-cdk/aws-sns');
import sns_sub = require('@aws-cdk/aws-sns-subscriptions');

// lots of code here...
       const pipeline: codepipeline.IPipeline = ...

        const topic = new sns.Topic(this, 'Topic', {
           topicName: 'codepipeline-events-consuming-topic',
        });
        topic.addSubscription(new sns_sub.EmailSubscription('your-email@example.com'));

        pipeline.onStateChange('PipelineStateChanged', {
            target: new event_targets.SnsTopic(topic),
        });
    }
}

Hope this helps!

Thanks, Adam

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws-cdk/aws-codestarnotifications module
Notification Source. This module includes classes that implement the INotificationRuleSource interface for AWS CodeBuild, AWS CodePipeline and will support AWS ...
Read more >
[pipelines] how to add notifications to a CDK pipeline ... - GitHub
There is no way to set up notifications for a CDK pipeline. ... import { CodePipeline, } from '@aws-cdk/pipelines'; const pipeline = new ......
Read more >
aws-codepipeline-notification-cdk-construct - Socket.dev
A simple notification application sending different status of your AWS CodePipeline to Slack or MS Teams using an incoming Webhook. You will get ......
Read more >
aws-cdk.aws-codestarnotifications - PyPI
The NotificationRule construct defines an AWS CodeStarNotifications rule. The rule specifies the events you want notifications about and the targets (such as ...
Read more >
CDK Unable to Add CodeStarNotification to CodePipeline
FWIW, I got the exact same error "Invalid request provided: AWS::CodeStarNotifications::NotificationRule" from a CDK app where the Topic was ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found