This is an AWS Lambda that allow to integrate CodeCommit Repository to BuddyBuild CI
- docker, docker-compose
- BuddyBuild account
- AWS account
- CodeCommit repository
- On BuddyBuild page: Create a new project from ssh repository by clicking
Add it with SSH!
action - On BuddyBuild page: Insert CodeCommit ssh repo in the
git clone URL
like this:ssh://git-codecommit.eu-west-1.amazonaws.com/v1/repos/test-codecommit-repository
- On BuddyBuild page: Copy ssh public key provided by BuddyBuild.
- On AWS page: Create IAM user Only to permit BuddyBuild to read the Repository. You have to give CodeCommit ReadOnly Access to the user. You can call it something like
BuddyBuildIntegration
- On AWS page: Go to
Security credentials
of the createdBuddyBuildIntegration
user - On AWS page: Click on
upload SSH public key
and insert ssh public key copied from the BuddyBuild page (on point [3.]) - On AWS page: Copy the generated
SSH key ID
- On BuddyBuild page: Append just after
ssh://
the copiedSSH key ID
in this way:ssh://[SSH_KEY_ID]@git-codecommit.eu-west-1.amazonaws.com/v1/repos/test-codecommit-repository
- On BuddyBuild page: Click start build app on BuddyBuild
- Go to
myProfile -> access_token
- copy the access_token
- copy the app id from url:
https://dashboard.buddybuild.com/apps/[APP-ID-YOU-HAVE-TO-COPY]?page=1
You need an account with Administration Access and use its AWS credentials to deploy the Lambda.
See Servelress Framework Guide
Copy .env.template
to .env
file and fill the fields with your AWS Admin Credentials, BuddyBuild tokens and other configuration variables
- Create and start local environment
$ docker-compose up -d
- Install dependencies
$ docker-compose exec codecommit-buddybuild npm install
- Deploy the configured Lambda on your AWS account for a specific stage (in this example is
prod
)$ docker-compose exec codecommit-buddybuild serverless deploy --stage prod
NB: On each .env
change, you have to reboot the container with:
$ docker-compose up -d
- Go to
Services -> Lambda
- Select
codecommit-buddybuild-integration
Lambda - Go to
triggers
tabs - Click
Add trigger
- Select
CodeCommit
trigger - Choose:
- Repository Name
- Trigger name
- event that triggers the lambda
- which branch trigger the lambda
Now you can try to push a commit to the target CodeCommit repository and see the logs with this command:
docker-compose exec codecommit-buddybuild serverless logs --function launchBuild --stage prod --startTime 1m -t