Giter Site home page Giter Site logo

jeprussell / aws-codecommit-selective-build-trigger Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aws-samples/aws-codecommit-selective-build-trigger

0.0 0.0 0.0 112 KB

Demo code to trigger AWS CodeBuild jobs for selective file changes in AWS CodeCommit repositories

License: MIT No Attribution

Python 100.00%

aws-codecommit-selective-build-trigger's Introduction

aws-codecommit-selective-build-trigger

This demo illustrates the deployment of AWS Lambda to build Docker Images of application in AWS CodeCommit repository automatically when selective files are modified and the changes are pushed to the repository. The AWS Lambda receives the AWS CodeCommit events for push to repository and triggers a AWS CodeBuild job to build the Docker image and push to AWS Elastic Container Registry.

AWS services used for the CI/CD portion:

Solution Diagram

Solution Diagram

Stack deployment

The cloudformation stack can be deployed using Cloudoformation page in AWS Console or using the AWS CLI as shown below

First, zip and upload the lambda code to an S3 bucket

cd src/

zip lambda.zip lambda_code.py

aws s3 cp lambda.zip s3://aws-codecommit-selective-build-trigger/

Trigger the cloudformation stack creation pointing to that S3 bucket zip.

aws cloudformation create-stack --stack-name myteststack --template-body file://src/aws-codecommit-selective-build-trigger.yml --parameters ParameterKey=ProjectName,ParameterValue=testproject ParameterKey=LambdaZipS3Bucket,ParameterValue=aws-codecommit-selective-build-trigger ParameterKey=LambdaZipS3Key,ParameterValue=lambda.zip --capabilities CAPABILITY_NAMED_IAM

Components details

src/aws-codecommit-selective-build-trigger.yml - Cloudformation template for demonstrating the solution of AWS Lambda triggered AWS CodeBuild job based on changes to specific files in AWS CodeCommit repository

src/lambda_code.py - Python code for AWS Lambda to filter the AWS CodeCommit event and find the files changed as part of the commit and trigger AWS CodeBuild job if needed.

src/lambda.zip - Compressed zip file for lambda_code.py file for deploying using Cloudformation template

License

This library is licensed under the MIT-0 License. See the LICENSE file.

aws-codecommit-selective-build-trigger's People

Contributors

amazon-auto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.