Skip to content
This repository has been archived by the owner on Sep 13, 2021. It is now read-only.

buildkite/aws-codepipeline-buildkite-custom-action-type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deprecated

Buildkite no longer uses AWS CodePipeline. This repository has been deprecated and is no longer maintained.

Using AWS CodePipeline with Buildkite

AWS CodePipeline integration for Buildkite that allows you to trigger Buildkite builds from within your CodePipeline pipelines. It consists of:

  • A set of custom-action-type JSON files for you to upload via the AWS CLI, enabling you to add and configure Buildkite tasks.
  • A custom checkout agent hook to override the default agent code checkout behavior to have it download code directly from the CodePipeline S3 artifact.

Requirements

  • aws cli tool
    You can test if the cli is configured by running aws codepipeline list-pipelines
  • jq
  • A Buildkite API access token with the read_builds and write_builds scope

Setup

1. Create your project on Buildkite

Create your project and steps as you normally would, but you don't need to a valid git repository URL as the source code will be downloaded via the CodePipeline's S3 bucket.

2. Add a new custom type to CodePipeline

The only way to create a custom CodePipeline action type is via the aws cli. There are separate JSON files for each of the types Source, Build, Test and Deploy

The following command creates a custom action type for a Buildkite Test action:

aws codepipeline create-custom-action-type --cli-input-json file://custom-action-types/test.json

3. Use the task in your pipeline

Add a new pipeline action:

Choose the type you created earlier:

Configure it with your Buildkite details:

4. Start a Buildkite agent with the customized checkout hook

buildkite-agent start --token xxx \
                      --hooks-path "$PWD/agent-hooks" \
                      --meta-data codepipeline=true

5. Run the CodePipeline job poller

$ ./poll.sh "category=Test,owner=Custom,version=1,provider=Buildkite"
Polling for CodePipeline job for action-type-id 'category=Test,owner=Custom,version=1,provider=Buildkite'

6. Create a release

Create a new release on CodePipeline, either with the "Release change" button or via the cli like so:

aws codepipeline start-pipeline-execution --name my-pipeline

Your job poller should pick up the job, create a Buildkite build, and report back on the status:

Found job. Creating build at https://api.buildkite.com/v1/organizations/myorg/projects/myproj/builds
Build #398 created - https://buildkite.com/myorg/myproj/builds/398
Acknowleding CodePipeline job (id: e3d5097b-5933-438d-af73-56d9eb0d5a41 nonce: 3)
Build is running
Build is running
Build finished
Updating CodePipeline job with 'passed' result

Your pipeline should now show the completed task, with a link to the successful Buildkite build:

🎉

License

See LICENSE (MIT)

About

Integrating AWS CodePipeline with Buildkite

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages