A DevOps Container for CircleCI

golden-gate-bridge-suspension-san-francisco-california-161764.jpeg
 

With the advent of CircleCI 2.0, Truss has become a fan of CircleCI and their support for delivery pipelines via workflows. We use CircleCI for both internal projects and client projects (when possible). Our test and deploy processes reuse a lot of the same tooling, so we’ve found ourselves reproducing similar setup steps across projects. For example, we use pre-commit for running pre-commit tests, shellcheck to ensure our BASH is up to snuff, and ecs-deploy for doing zero-downtime deploys.

With CircleCI workflows, every job uses its own container. That environment isolation is great, but it means we install many of the same tools multiple times in a single build. That leads to longer build times as things install, and if you’re relying on external sites to download from, it creates additional opportunities for the install to fail and break the build. To remove that overhead from our builds and skip adding the same setup scripts to every new project, we now have a single custom-built docker image we can use across jobs and projects.

Built from an official CircleCI image, our custom-built image includes the default tooling needed to be a CircleCI “primary container”. Today, we include the following additional tools:

See the current README (or Dockerfile) for an up to date list.

To use this image in your own CircleCI jobs, specify the image like:

version: 2
jobs:
   build:
     docker:
       - image: trussworks/circleci-docker-primary:master

To follow best practices, replace “master” with a git hash instead. You can find the hash of our most recent, stable build from our MicroBadger page.

A note on our use of “DevOps”: we view DevOps not as a team, a specific set of engineering responsibilities or tools, but as an organization-wide methodology to quickly improve a product via fast release cycles and high visibility into all stages of the process. This container is one part of that larger process.

A note on our philosophy on delivery pipelines: an effective delivery pipeline is important for creating a successful DevOps culture. This mechanism brings code from development into production, ties together the (technical and non-technical) teams, and enables the company to iterate quickly. We have lots to say about this and will have a more in-depth piece on this soon.