Can AWS CodeBuild and CodePipeline be combined to build the described CI workflow?

I am trying to create the following CI stream with standard AWS tools: run the commit assembly when the Pull Request on Github is created or updated. Or start building any branch on my command. It is very similar to what Codeship, Travis and many other CI services offer.

Is this possible with CodeBuild + CodePipeline? I noticed that I have to specify the exact branch in CodePipeline and, unfortunately, could not find how to integrate Github Pull requests into it. Maybe I missed it?

+8
amazon-web-services aws-codepipeline
source share
5 answers

It seems like this can be done somewhat manually using Lambda and S3 - https://aws.amazon.com/blogs/devops/integrating-git-with-aws-codepipeline/

Webhooks notifies the remote service by sending an HTTP POST when the commit is passed to the repository. AWS Lambda receives an HTTP POST through the Amazon API Gateway, and then downloads a copy of the repository. It puts the zip copy of the repository in the slave S3 bucket. AWS CodePipeline can then use the zip file in S3 as a source; the pipeline will run whenever the Git repository is updated.

+2
source share

CodeBuild now directly supports creating GitHub output requests (without the Lambda intermediate step) if you want to just run the build as part of the PR. To perform additional steps with CodePipeline as part of your PR, you will still need to configure some scaffolding, as other answers suggest. https://aws.amazon.com/about-aws/whats-new/2017/09/aws-codebuild-now-supports-building-github-pull-requests/

+4
source share

CodePipeline supports the basic, fully managed integrations with GitHub and CodeBuild, listed in Integrating Products and Services with AWS CodePipeline . Using these integrations, you can use CodeBuild with CodePipeline to start commit builds when the commit is passed to the branch on GitHub. See Use AWS CodePipeline with AWS CodeBuild to run the build for more information on integrating CodeBuild with CodePipeline as a Build action provider, and see the Four Level Pipeline Guide for details on integrating Github with CodePipeline as a Source action provider.

Github's Pull request function is currently not supported in the official CodePipeline integration, you havenโ€™t noticed anything. For an interesting AWS open source project (not yet v1.0) that supports integration with GitHub Pull Request (although not yet CodePipeline ) you can check out LambCI .

+3
source share

You can try https://www.deploytoproduction.com to integrate with Github Pull build status using AWS CodeBuild. It is free for one Github repository with a subscription plan available for multiple repositories. The service does not currently integrate with CodePipeline, but it is coming soon.

PR Build Passed Screenshot

If you want to create something yourself, you can do a new integration on GitHub, which uses the webhook functionality to launch the lambda function, which in turn launches your CodeBuild jobs or pushes an artifact on S3 to launch CodePipeline.

Full disclosure I am the author of this service

0
source share

I ran into the same problem and ended up writing a step-by-step guide on two different ways to do this depending on your source repository.

How to track multiple Git branches in AWS CodePipeline

[TL; DR]

GitHub or Bitbucket: Create a CodeBuild project using webhook and use S3 as the source.

CodeCommit: create a lambda trigger that creates a new pipeline for each branch.

0
source share

All Articles