A simple job worker for custom actions in AWS CodePipeline. Built to be easily extended to accomodate other custom jobs not already implemented.
- Create your AWS CodePipeline and set up a custom action (included in this repo is a custom job configuration for Travis builds)
- Host
aws_codepipeline_job_workeranywhere (laptop, EC2 instance, etc.). - Set up your credentials.
- Run application 🎉
The structure of actions/ should be as follows:
custom_action_1/
├── dispatcher.go
├── job.go
│
...
custom_action_N/
├── dispatcher.go
├── job.go
Each custom action is expected to have a dispatcher and a job.
dispatcher is responsible for implementing the methods
defined in the interface, which are responsible for starting the poller for that action type, as well as kicking off a new job. The main meat of the logic for the custom action should live in job, which is responsible for initializing itself, and reporting back the correct
status to AWS CodePipelin (see pkg/actions/travis/dispatcher and pkg/actions/travis/job for a working example.
main.gofires off all dispatchers (e.x.travis.NewDispatcher().Initialize()).- The dispatcher starts a
pollerin a new thread for that particular custom action. - The poller polls CodePipeline intermittently, calling
PollForJobs. - Once a job is available, CodePipeline will return the job.
pollerwill call it'sdispatcher'sDispatchmethod.dispatcherwill kick off the job in a new thread.jobwill do all of the interaction with the third party service, such as submitting a build, polling for progress, updating CodePipeline with intermediate statuses/info such as anExecutionID- Once the job is complete
jobwill update CodePipeline a final time with the result status.
- Tons of refactoring, mainly in
job.rb- Address TODOs
- Refactor nested ifs and general error handling
- Add configuration support
- Add tests
- Improve documentation
