This CDK project creates codepipelines that are triggered by a lambda function. A Lambda function controls when a codepipeline is triggered so that is possible to have better control of when pipelines must start.
node >= 18.18.0
npm >= 9.8.1
cdk >= 2.102.0
aws-cli >= 2.11.15
npm run build
compile typescript to jsnpm run watch
watch for changes and compilecdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template
With the following instructions you will be able to setup a codepipeline to build and deploy docker images when commits are pushed to a codecommit repository.
- Create a codecommit repository
- Push the content of the
./sample-repository
folder to this codecommit repository - Copy the codecommit repository ARN and its name
- Open
./lib/docker-image-pipeline-stack.ts
and change thedockerImagePipelines
variable to:
obs: remember to change REPOSITORY_NAME
and REPOSITORY_ARN
with the values you copied before
const dockerImagePipelines = [
{
codecommitRepository: codecommit.Repository.fromRepositoryArn(
this,
"REPOSITORY_NAME",
"REPOSITORY_ARN"
),
branches: [
'main',
'develop'
]
},
]
- Open
./bin/cdk-docker-image-pipeline.ts
and setenv
with your account id and region. - run
npm install
- run
cdk deploy
After that you should have configured a codepipeline for your codecommit repository. It will trigger whenever a commit is pushed to main
or develop
branches.