AWS CodeCommit Construct Library
To add a CodeCommit Repository to your stack:
import codecommit = require('@aws-cdk/aws-codecommit');
const repository = new codecommit.Repository(this, 'Repository' ,{
repositoryName: 'MyRepositoryName'
});
To add an SNS trigger to your repository:
import codecommit = require('@aws-cdk/aws-codecommit');
const repository = new codecommit.Repository(this, 'Repository', {
repositoryName: 'MyRepositoryName'
});
repository.notify('arn:aws:sns:*:123456789012:my_topic');
CodePipeline
To use a CodeCommit Repository in a CodePipeline:
import codecommit = require('@aws-cdk/aws-codecommit');
import codepipeline = require('@aws-cdk/aws-codepipeline');
const repository = new codecommit.Repository(
);
const pipeline = new codepipeline.Pipeline(this, 'MyPipeline', {
pipelineName: 'MyPipeline',
});
const sourceStage = new codepipeline.Stage(this, 'Source', {
pipeline,
});
const sourceAction = new codecommit.PipelineSourceAction(this, 'CodeCommit', {
stage: sourceStage,
artifactName: 'SourceOutput',
repository,
});
You can also add the Repository to the Pipeline directly:
const sourceAction = repository.addToPipeline(sourceStage, 'CodeCommit', {
artifactName: 'SourceOutput',
});
Events
CodeCommit repositories emit CloudWatch events for certain activity.
Use the repo.onXxx
methods to define rules that trigger on these events
and invoke targets as a result:
repo.onCommit('CommitToMaster', project, 'master');
const rule = repo.onCommentOnPullRequest('CommentOnPullRequest');
rule.addTarget(myTopic);
0.10.0 (2018-09-27)
This release introduces a better way to "escape" L2 constructs in case of missing features by adding the ability to add arbitrary overrides for resource properties:
const bucket = new s3.Bucket(this, 'L2Bucket');
// access L1
const bucketResource = bucket.findChild('Resource') as s3.cloudformation.BucketResource;
// strongly-typed overrides
bucketResource.propertyOverrides.bucketName = 'amzn-s3-demo-bucket';
// weakly-typed overrides
bucketResource.addPropertyOverride('BucketName', 'amzn-s3-demo-bucket1');
Bug Fixes
Code Refactoring
Features
- aws-cloudformation: rename the CodePipeline actions (#771) (007e7b4)
- aws-cloudformation: update the README of the module to reflect the new action names (#775) (6c0e75b), closes #771
- aws-codedeploy: add auto-scaling groups property to ServerDeploymentGroup (#739) (0b28886)
- aws-codedeploy: add deployment configuration construct (#653) (e6b67ad)
- aws-codepipeline, aws-codecommit, aws-s3: change the convention for naming the source Actions to XxxSourceAction (#753) (9c3ce7f)
- aws-elasticloadbalancingv2: support for ALB/NLB (#750) (bd9ee01)
- tagging support for AutoScaling/SecurityGroup (#766) (3d48eb2)
- core: resource overrides (escape hatch) (#784) (5054eef), closes #606
- toolkit: stop creating 'empty' stacks (#779) (1dddd8a)
BREAKING CHANGES TO EXPERIMENTAL FEATURES
- cdk: the constructor signature of
TagManager
has changed. initialTags
is now passed inside a props object. - util:
@aws-cdk/util
is no longer available - aws-elasticloadbalancingv2: adds classes for modeling Application and Network Load Balancers. AutoScalingGroups now implement the interface that makes constructs a load balancing target. The breaking change is that Security Group rule identifiers have been changed in order to make adding rules more reliable. No code changes are necessary but existing deployments may experience unexpected changes.
- aws-cloudformation: this renames all CloudFormation Actions for CodePipeline to bring them in line with Actions defined in other service packages.
- aws-codepipeline, aws-codecommit, aws-s3: change the names of the source Actions from XxxSource to XxxSourceAction. This is to align them with the other Actions, like Build. Also, CodeBuild has the concept of Sources, so it makes sense to strongly differentiate between the two.
CloudFormation Changes