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-codestarnotifications): CodeCommit repository not supported as source for Notification Rule

See original GitHub issue

Currently @aws-cdk/aws-codestarnotifications module does not seem to support using repository as the source. However, this does appear to be supported in Cloudformation. From the CDK api docs: “Currently, Supported sources include pipelines in AWS CodePipeline and build projects in AWS CodeBuild in this L2 constructor.”

and from CloudFormation template reference: “Supported resources include pipelines in AWS CodePipeline, repositories in AWS CodeCommit, and build projects in AWS CodeBuild.”

In the console notification rules can easily be created for repository events and sent to SNS or Chatbot targets. I would like to replicate that with the CDK.

Environment

  • CDK CLI Version: 1.109.0
  • Module Version: 1.109.0
  • Node.js Version: 14.17.0
  • OS: Windows 10
  • Language (Version): 4.3.4

Other information

According to CloudFormation, an ARN is required, however re-creating an ARN won’t work INotificationRuleSource won’t accept a string. Ideally it should work something like this:

    const repositoryNotification = new NotificationRule(this, 'PullRequestNotificationRule', {
      source: repository.repositoryArn,
      events: [
        'codecommit-repository-pull-request-created',
        'codecommit-repository-pull-request-merged'
      ],
      targets: [chatbot],
      detailType: DetailType.FULL,
      notificationRuleName: 'pull-request-status'
    })
    repositoryNotification.addTarget(chatbot)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
badfuncommented, Jul 22, 2021

@luckily Back in business. I followed the blog post you referenced and used WSL2 on WIndows. Got the environment working. Now I can go back to working on the code.

@aws-cdk/aws-codecommit: yarn run v1.22.10
@aws-cdk/aws-codecommit: $ cdk-test
@aws-cdk/aws-codecommit: test.codecommit.js
@aws-cdk/aws-codecommit: ✔ CodeCommit Repositories - add an SNS trigger to repository
@aws-cdk/aws-codecommit: ✔ CodeCommit Repositories - fails when triggers have duplicate names
@aws-cdk/aws-codecommit: ✔ CodeCommit Repositories - can be imported using a Repository ARN
@aws-cdk/aws-codecommit: ✔ CodeCommit Repositories - can be imported using a Repository ARN and respect the region in clone urls
@aws-cdk/aws-codecommit: ✔ CodeCommit Repositories - can be imported using just a Repository name (the ARN is deduced)
@aws-cdk/aws-codecommit: ✔ CodeCommit Repositories - grant push
@aws-cdk/aws-codecommit: ✔ CodeCommit Repositories - HTTPS (GRC) clone URL
@aws-cdk/aws-codecommit: OK: 13 assertions (10484ms)
@aws-cdk/aws-codecommit: =============================== Coverage summary ===============================
@aws-cdk/aws-codecommit: Statements   : 57.38% ( 70/122 )
@aws-cdk/aws-codecommit: Branches     : 57.78% ( 26/45 )
@aws-cdk/aws-codecommit: Functions    : 31.11% ( 14/45 )
@aws-cdk/aws-codecommit: Lines        : 57.02% ( 69/121 )
@aws-cdk/aws-codecommit: ================================================================================
@aws-cdk/aws-codecommit: Verifying integ.codecommit-events.js against integ.codecommit-events.expected.json ... OK.
@aws-cdk/aws-codecommit: Tests successful. Total time (42.1s) | /mnt/c/Users/Ken/cloud/dev/aws-cdk/aws-cdk/node_modules/nyc/bin/nyc.js (28.8s) | cdk-integ-assert (13.1s)
@aws-cdk/aws-codecommit: Done in 44.00s.
lerna success run Ran npm script 'test' in 1 package in 44.5s:
lerna success - @aws-cdk/aws-codecommit
0reactions
github-actions[bot]commented, Aug 25, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring notifications for events in an AWS CodeCommit ...
You can set up notification rules for a repository so that repository users receive emails about the repository event types you specify.
Read more >
aws-codestarnotifications: support NotificationRule #5020
[Not a Contribution] With the introduction of notifications for AWS CodeCommit, AWS CodeBuild, AWS CodeDeploy, and AWS CodePipeline, ...
Read more >
aws.codestarnotifications.NotificationRule - Pulumi
A list of event types associated with this notification rule. For list of allowed events see here. resource. This property is required.
Read more >
aws_codestarnotifications_notific...
Provides a CodeStar Notifications Rule. Example Usage. resource "aws_codecommit_repository" "code" { repository_name = " ...
Read more >
CodeCommit Notification does not send event to SNS
The rule target SNS topic has a policy that allows principal *. However when I created a pull request. There is no event...
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