-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pipelines] how to add notifications to a CDK pipeline? or: expose underlying CodePipeline object #9710
Comments
I did a hacky thing and used the typescript |
Any update on this please? The only workaround at the moment is to manually build the pipeline arn based on the deterministic name which is not ideal |
I need this as well |
You can get codestar notifications working with CDK pipelines using the below code snippet.
|
The same applies to the pipelines from aws_cdk, although there is no codePipeline object available thus setting up notification fails miserably.
|
@TomaszSzusterTR could the error be because you forgot your brackets around your props?
UPDATE: ah I just noticed your first comment. source should be |
EDIT 2: Adding
|
@federicobarera where did you add the On the other end, it seems like the cdk is forgetting to give permissions to the NotificationRule to publish to the sns topic. I am seeing After some research it seems that I need to add the IAM policy to the notificationRule: and the cdk
|
@samlaf I must have my wires crossed. Confirm it works after including |
Thank you mate.
|
I need to add resource policy mentioned by @samlaf's before i can deploy the template. But for an existing SNS topic, the const targetTopic = sns.Topic.fromTopicArn(
this,
"sns-notification-topic",
topicArn
);
targetTopic.addToResourcePolicy(
new iam.PolicyStatement({
sid: "AWSCodeStarNotifications_publish",
effect: iam.Effect.ALLOW,
principals: [
new iam.ServicePrincipal("codestar-notifications.amazonaws.com"),
],
actions: ["SNS:Publish"],
resources: ["*"],
})
); |
I am trying it out in python.
but i am getting.
is there any work around? or is there something i missed? |
@Sumanthshetty23 in python the function should be called as below :
|
@Sumanthshetty23, maybe you're using @aws-cdk/code_pipelines instead @aws-cdk/pipelines module |
As far as I can tell, there is no way with the current CDK pipeline API to add codestarnotifications to the underlying CodePipeline, because there is no way to get the ARN of the CodePipeline.
The CdkPipeline has a private variable that holds the reference to the CodePipeline, but we can't access it. I imagine that it would be useful for developers to have access to this for many other reasons as well.
Use Case
There is no way to set up notifications for a CDK pipeline.
Proposed Solution
Change CdkPipeline
private readonly _pipeline
member variable to public.Other
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: