AWS CodeCommit Construct Library
AWS CodeCommit is a version control service that enables you to privately store and manage Git repositories in the AWS cloud.
For further information on CodeCommit,
see the AWS CodeCommit documentation.
To add a CodeCommit Repository to your stack:
import codecommit = require('@aws-cdk/aws-codecommit');
const repo = new codecommit.Repository(this, 'Repository' ,{
repositoryName: 'MyRepositoryName',
description: 'Some description.',
});
To add an Amazon SNS trigger to your repository:
repo.notify('arn:aws:sns:*:123456789012:my_topic');
Events
CodeCommit repositories emit Amazon CloudWatch events for certain activities.
Use the repo.onXxx
methods to define rules that trigger on these events
and invoke targets as a result:
repo.onCommit('CommitToMaster', {
target: new targets.CodeBuildProject(project),
branches: ['master'],
});
const rule = repo.onCommentOnPullRequest('CommentOnPullRequest', {
target: new targets.SnsTopic(myTopic),
});