Skip to content
Powerful DSL to easily create and manage AWS CodeBuild projects
Ruby Shell
Branch: master
Clone or download
Latest commit 7b8cdcd Nov 10, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.cody update repo Oct 2, 2019
docs update top-left logo Nov 8, 2019
exe rename codebuild to cody Oct 1, 2019
img update github oauth readme Jun 2, 2019
lib 0.7.2 release Nov 10, 2019
spec rename .codebuild to .cody Oct 1, 2019
vendor update vendor gems Jun 30, 2019
.gitignore add specs, update readme, cleanup Apr 26, 2019
.rspec working codebuild deploy Apr 25, 2019
.ruby-version update ruby version 2.5.6 Sep 1, 2019 0.7.2 release Nov 10, 2019
Gemfile first commit Apr 1, 2019
Guardfile first commit Apr 1, 2019
LICENSE.txt add docs Jul 26, 2019 add cody logo to readme Nov 7, 2019
Rakefile rename codebuild to cody Oct 1, 2019
cody.gemspec add mfa support Nov 10, 2019


Build Status Gem Version

Cody lets you create a AWS CodeBuild projects with a beautiful DSL.

The documentation site is at:

Quick Start

cody init
cody deploy
cody start

Private Repo

IMPORTANT: Before deploying, if you are using a private repo, use aws codebuild import-source-credentials to add credentials so that codebuild can clone down the repo. Refer to the CodeBuilld Github Oauth/ for more info.


  1. init: generate starter .cody files.
  2. deploy: deploy the CodeBuild project on AWS.
  3. start: kick off a CodeBuild project run.

Init and Structure

First, run cody init to generate a starter .cody folder structure.

$ tree .cody
├── buildspec.yml
├── project.rb
└── role.rb
File Description
buildspec.yml The build commands to run. Here are the buildspec.yml syntax docs.
project.rb The codebuild project written as a DSL. Here are the Project DSL docs
role.rb The IAM role associated with the codebuild project written as a DSL. Here are the IAM Role DSL docs


Adjust the files in .cody to fit your needs. When you're ready, deploy the CodeBuild project with:

cody deploy PROJECT_NAME

More examples:

cody deploy # infers the CodeBuild project name from the parent folder
cody deploy PROJECT_NAME # explicitly specify project name

It is useful to just see the generated CloudFormation template with --noop mode:

cody deploy --noop # see generated CloudFormation template

For more help:

cody deploy -h


When you are ready to start a codebuild project run, you can use codebuild start. Examples:

cody start # infers the name from the parent folder
cody start PROJECT_NAME # looks up project via CodeBuild project name

The cody start command understands multiple identifiers. It will look up the codebuild project either via CloudFormation or the CodeBuild project name.

Project DSL

The tool provides a DSL to create a codebuild project. Here's an example.


# name("demo") # recommended to leave unset and use the conventional name that cody sets
  UFO_ENV: "development",
  API_KEY: "ssm:/codebuild/demo/api_key" # ssm param example

Here's a list of some of the convenience shorthand DSL methods:

  • github_url(url)
  • github_source(options={})
  • linux_image(name)
  • linux_environment(options={})
  • environment_variables(vars)
  • local_cache(enable=true)

Please refer to lib/codebuild/dsl/project.rb for the full list.

More slightly more control, you may be interested in the github_source and linux_environment methods. For even more control, see DSL docs.


Cody can create the IAM service role associated with the codebuild project. Here's an example:


iam_policy("logs", "ssm")

For more control, here's a longer form:

  action: [
  effect: "Allow",
  resource: "*"

You can also create managed iam policy.


Schedule Support


rate "1 day"

Full DSL

The convenience DSL methods shown above are short and clean. They merely wrap a DSL that map to the properties of CloudFormation resources like AWS::CodeBuild::Project and AWS::IAM::Role. Refer the DSL docs for more info.

Type Option

By default, cody looks up files in the .cody folder. You can affect the behavior of the Type logic with the --Type option. More info Type docs.


Add this line to your application's Gemfile:

gem "cody"

And then execute:


Or install it yourself as:

gem install cody


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am "Add some feature")
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
You can’t perform that action at this time.