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.
tl;dr: Use a machine executor with an image that has a recent version of Docker (eg.
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
which contains everything Batect requires:
If you're using caches, you can persist these between builds with the following configuration:
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,
go.sum. CircleCI's documentation for caching has
more details on
CircleCI 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: