aws-cdk: (@aws-cdk/aws-codestarnotifications): CodeCommit repository not supported as source for Notification Rule
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)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (15 by maintainers)
Commits related to this issue
- feat(codecommit): make Repository a source for CodeStar Notifications (#15739) ---- Fixes #15653 Notification rule can be created for CodeCommit Repository events using @aws-cdk/aws-codestarnotif... — committed to aws/aws-cdk by badfun 3 years ago
- feat(codecommit): make Repository a source for CodeStar Notifications (#15739) ---- Fixes #15653 Notification rule can be created for CodeCommit Repository events using @aws-cdk/aws-codestarnotif... — committed to hollanddd/aws-cdk by badfun 3 years ago
- feat(codecommit): make Repository a source for CodeStar Notifications (#15739) ---- Fixes #15653 Notification rule can be created for CodeCommit Repository events using @aws-cdk/aws-codestarnotif... — committed to TikiTDO/aws-cdk by badfun 3 years ago
- feat(codecommit): make Repository a source for CodeStar Notifications (#15739) ---- Fixes #15653 Notification rule can be created for CodeCommit Repository events using @aws-cdk/aws-codestarnotif... — committed to david-doyle-as24/aws-cdk by badfun 3 years ago
@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.