AWS Lambda script to create Buildkite builds when code is pushed to AWS CodeCommit
yarn install
yarn build
Windows
yarn install
yarn build-win
- Go to Lambda AWS console
- Create function
- Author from scratch
- Add a name of your choosing
- Set runtime to Node 8.10
- Create a custom role
- Add a role name of your choosing
- View policy document -> Edit -> Ok, paste this policy:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codecommit:GetCommit" ], "Resource": "arn:aws:codecommit:*:*:*" } ] }
- Allow
- Create function
- Code entry type - change to "Upload a .ZIP file"
- Upload
codecommit-buildkite.zip
- Add environment variables:
- BUILDKITE_ORG: slug for your buildkite account
- BUILDKITE_PIPELINE: slug for the pipeline to build on
- BUILDKITE_TOKEN: API token - create it under Personal Settings -> API Access Tokens, and give it permission to modify builds
- Add triggers -> CodeCommit
- Select repository to watch
- Fill in trigger name of "buildkite" (or whatever makes sense to you, this is the name you will see when you browse triggers in CodeCommit)
- Remove the "All repository events" event type, and add "Create branch or tag" and "Push to existing branch"
- Add the trigger
- Save