View a markdown version of this page

Pull request continuous integration - DevOps and CI/CD Reference Architecture Diagrams

Pull request continuous integration

Publication date: July 14, 2022 (Diagram history)

With this architecture, you can build a continuous integration pipeline for Git pull requests by using AWS CodeBuild, AWS CodePipeline, and AWS Lambda.

Pull request continuous integration diagram

Pull request continuous integration pipeline using CodeBuild, CodePipeline, and Lambda with Git providers.

The following steps describe the architecture:

  1. Webhooks connect supported Git providers (such as GitHub or Bitbucket) and AWS CodeBuild. The Git provider sends events when a PR is created or updated. For AWS CodeCommit, an AWS Lambda function triggers the build.

  2. CodeBuild accepts Git PR events and compresses the PR codebase in an archive. It stores this archive in the Git Artifacts Amazon S3 bucket. CodeBuild then posts a message on an Amazon Simple Queue Service queue about a fresh codebase ready for processing.

  3. An Lambda function polls the Amazon SQS queue and consumes the message. It starts the CI process and moves the new codebase to the Pipeline Source Amazon S3 bucket. The Lambda function checks automation prerequisites. It also removes obsolete codebases from the backlog when updates target an existing PR.

  4. AWS CodePipeline orchestrates the CI workflow. It validates the codebase, runs unit tests, builds artifacts, creates a preview environment, and runs integration and end-to-end (E2E) tests. Amazon EventBridge monitors pipeline stage changes. An Lambda function updates the PR based on status events (success, in progress, failed, completed).

Further reading

For additional information, see the following resources: