Real-world CodePipeline CI/CD examples
AWS CodePipeline helps us to orchestrate CI/CD pipelines. To implement real-world pipelines, CodePipeline calls additional AWS services to do the work. E.g., CodeBuild to run arbitrary scripts, CloudFormation to create or update stacks, or CodeDeploy to deploy software to running EC2 instances. A pipeline is connected to sources such as a git repository (Bitbucket, GitHub, and GitHub Enterprise Server, CodeCommit), an S3 bucket, or an ECR repository. If a source changes, the pipeline executes.
But how do real-world pipelines look like? In this post, I share pipelines with you, from simple to complex.
The following pipeline connects to a GitHub repository. CodeBuild is used to build a Docker image, and CodeBuild is used to push the Docker image and deploy it into production.
This pipeline comes with several disadvantages:
- It runs no unit tests
- It runs no acceptance tests in a pre-prod environment
The following pipeline excerpt shows a pipeline where manual acceptance tests prevent bugs from reaching production. Not perfect, but better than before!
Please support our work!
We have published 334 articles, 42 podcast episodes, and 15 videos. It's all free and means a lot of work in our spare time.
$6,000.00 will help us to write in-depth service reviews and comparisons in 2022! With your help, we can continue to produce independent & high-quality content focused on AWS.
Thanks to Alan Leech, Alex DeBrie, ANTHONY RAITI, e9e4e5f0faef, Jeff Finley, jhoadley, Johannes Grumböck, Jonas Mellquist, Ken Snyder, Ross Mohan, Thorsten Hoeger, Todd Valentine, and all anonymous supporters for your help! We also want to thank all supporters who purchased a cloudonaut t-shirt.Support us
We could still do better by running automated acceptance tests, right?
The following video goes into details and includes demos:
- CodePipeline 101
- Real-world CodePipeline examples
- Demo: marbot pipeline
- Pitfall: Update pipeline in pipeline
My last example shows a pipeline excerpt that AWS uses to deploy parts of CodePipeline itself. You can see how new changes are rolled out in phases—starting with a single region to lower the risk.
I used a similar approach in a pipeline to deploy an environment per customer (the application was missing multi-tenant capabilities).
CodePipeline is the pipeline orchestrator. CodePipeline calls other AWS services to implement a CI/CD pipeline.