Releasecop

Given a list of projects and environments pipelines, report which environments are "behind" and by which commits.

Installation

gem install releasecop

Usage

Open the manifest file, which defines projects to monitor:

releasecop edit

In the manifest, each project lists the environments to which code is deployed in order of promotion. Environments are defined by a name and git remote. E.g., a github repo for development and heroku apps for staging and production. Optionally, an environment can include branch or hokusai properties. E.g.:

{
  "projects": {
    "charge": [
      {"name": "master", "git": "[email protected]:artsy/charge.git"},
      {"name": "staging", "git": "[email protected]:charge-staging.git"},
      {"name": "production", "git": "[email protected]:charge-production.git"}
    ],
    "heat": [
      {"name": "master", "git": "[email protected]:artsy/heat.git"},
      {"name": "master-succeeded", "git": "[email protected]:artsy/heat.git", "branch": "master-succeeded"},
      {"name": "production", "git": "[email protected]:artsy/heat.git", "branch": "production"}
    ]
  }
}

To check the release status of a project:

releasecop check [PROJECT]

Example output:

charge...
  staging is up-to-date with master
  production is up-to-date with staging
heat...
  master-succeeded is up-to-date with master
  production is behind master-succeeded by:
    4557f60 2015-03-24 Upgrade to 3.9 (timsmith)
    f33acc4 2015-03-25 Add support for avatars (janeR)
2 project(s) checked. 1 environment(s) out-of-date.

To check all projects:

releasecop check --all

Heroku Pipelines

At this time releasecop is not compatible with projects using Heroku Pipelines to promote apps. For these apps, promoting a staging app to production simply copies the slug to the production app, so no git remote is updated.

Hokusai Pipelines

Hokusai is a tool developed by Artsy for managing apps on Kubernetes. Releasecop's manifest can include environments with a hokusai property containing a docker image tag corresponding to the pipeline stage. (The hokusai executable and access to the image repository must be available locally.) E.g.:

{
    "test-api": [
      {"name": "master", "git": "[email protected]:artsy/test-api.git" },
      {"name": "staging", "git": "[email protected]:artsy/test-api.git", "hokusai": "staging"},
      {"name": "production", "git": "[email protected]:artsy/test-api.git", "hokusai": "production"}
    ]
}

Releasecop will determine the git SHAs corresponding with each pipeline stage via the hokusai registry images command.

Tagged Releases

Many teams create git tags corresponding to each milestone or release. The tag_pattern property can be used to match sets of tags corresponding to an environment. E.g.:

{
    "causality": [
      {"name": "master", "git": "[email protected]:artsy/causality.git" },
      {"name": "staging", "git": "[email protected]:artsy/causality.git", "tag_pattern": "staging-*"},
      {"name": "production", "git": "[email protected]:artsy/causality.git", "tag_pattern": "release-*"}
    ]
}

The most recent commit matching each tag expression is presumed to correspond with the state of each environment. Tag patterns follow git conventions, so, e.g., staging-* will be treated as /refs/tags/staging-*.

Copyright (c) 2015-2018 Joey Aghion, Artsy