CircleCI
Using Batect with CircleCI is straightforward. Recent machine executor images contain everything you need to use Batect.
You can see a full example of using Batect with CircleCI in the Golang sample project.
#
Environmenttip
tl;dr: Use a machine executor with an image that has a recent version of Docker (eg. ubuntu-2004:202010-01
).
CircleCI's recent machine executor images include everything Batect requires. All that needs to be done to use Batect with CircleCI is to configure it to use one of those machine executor images.
Adding the following to your .circleci/config.yml
file instructs CircleCI to use a machine executor with the ubuntu-2004:202010-01
image,
which contains everything Batect requires:
#
Caching between buildsIf you're using caches, you can persist these between builds with the following configuration:
The key
should be a value that changes when the contents of the cache change, and remains constant otherwise. A good candidate is the hash of a dependency lockfile,
such as Gemfile.lock
, package-lock.json
, yarn.lock
or go.sum
. CircleCI's documentation for caching has
more details on key
.
#
Simplifying configurationCircleCI supports defining reusable commands within your configuration file. This can be useful if you find yourself running the same series of commands over and over again.
For example, if you have a series of jobs, each of which checks out your code, restores the cache, runs a Batect task and then saves the cache, you can define a command that contains all of these steps:
...and then reuse it in each job: