- Homebrew
- Debian-based distributions (Debian, Ubuntu, etc.)
- RPM-based distributions (Fedora, CentOS, etc.)
- Prebuilt Binary
- Golang
- CI integrations
Since currently CLI runs all of it's tasks either via Docker or Podman, make sure one of these is installed.
Docker is available on a variety operating systems and distributions.
OS-specific instructions can be found here: https://docs.docker.com/get-docker/
Podman is generally only available on Linux.
Distribution-specific instructions can be found here: https://podman.io/getting-started/installation
When Podman binary is found on the system it'll be used automatically, however, if there's also a Docker installed, then it will be preferred instead.
To force the CLI to use Podman backend, pass the --container-backend=podman
flag when running a build:
cirrus run --container-backend=podman Lint
Follow the Podman's official rootless tutorial to configure a rootless environment.
Once this is done, you can use the Podman backend as you'd normally do, without becoming a root
brew install cirruslabs/cli/cirrus
Firstly, make sure that the APT transport for downloading packages via HTTPS and common X.509 certificates are installed:
sudo apt-get update && sudo apt-get -y install apt-transport-https ca-certificates
Then, add the Cirrus Labs repository:
echo "deb [trusted=yes] https://apt.fury.io/cirruslabs/ /" | sudo tee /etc/apt/sources.list.d/cirruslabs.list
Finally, update the package index files and install the Cirrus CLI:
sudo apt-get update && sudo apt-get -y install cirrus-cli
First, create a /etc/yum.repos.d/cirruslabs.repo
file with the following contents:
[cirruslabs]
name=Cirrus Labs Repo
baseurl=https://yum.fury.io/cirruslabs/
enabled=1
gpgcheck=0
Then, install the Cirrus CLI:
sudo yum -y install cirrus-cli
Check the releases page for a pre-built cirrus
binary for your platform.
Here is a one liner for Linux/macOS to download the latest release and add
curl -L -o cirrus https://github.com/cirruslabs/cirrus-cli/releases/latest/download/cirrus-$(uname | tr '[:upper:]' '[:lower:]')-amd64 \
&& sudo mv cirrus /usr/local/bin/cirrus && sudo chmod +x /usr/local/bin/cirrus
If you have Go 1.17 or newer installed, you can run:
go install github.com/cirruslabs/cirrus-cli/...@latest
This will build and place the cirrus
binary in $GOPATH/bin
.
To be able to run cirrus
command from anywhere, make sure the $GOPATH/bin
directory is added to your PATH
environment variable (see article in the Go wiki for more details).
Here is an example .github/workflows/cirrus.yml
configuration file that runs Cirrus Tasks using CLI:
name: Run Cirrus Tasks
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
cirrus:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cirruslabs/cirrus-action@v2
Note: Cirrus Action integrates natively with GitHub Actions caching mechanism by using HTTP Caching Proxy Action
Here is an example of .travis.yml
configuration file that runs Cirrus Tasks using CLI:
services:
- docker
cache:
directories:
- /home/travis/.cache/cirrus/
before_install:
- curl -L -o cirrus https://github.com/cirruslabs/cirrus-cli/releases/latest/download/cirrus-linux-amd64
- sudo mv cirrus /usr/local/bin/cirrus
- sudo chmod +x /usr/local/bin/cirrus
script: cirrus run
Here is an example of .circleci/config.yml
configuration file that runs Cirrus Tasks using CLI:
version: 2.1
jobs:
build:
machine: true
steps:
- checkout
- run: |
curl -L -o cirrus https://github.com/cirruslabs/cirrus-cli/releases/latest/download/cirrus-linux-amd64
sudo mv cirrus /usr/local/bin/cirrus
sudo chmod +x /usr/local/bin/cirrus
- run: cirrus run
Ensure that the CLI will run on the host itself (it should use a non-Dockerized agent) and this host has Docker installed.
Create a build step with the "Command Line" runner type and the following custom script contents:
curl -L -o cirrus https://github.com/cirruslabs/cirrus-cli/releases/latest/download/cirrus-linux-amd64
chmod +x ./cirrus
./cirrus run
The resulting configuration should look like this:
Note: you can also preinstall the CLI on the agent itself to skip downloading it each time and just execute cirrus run
during the step.
Here is an example of cloudbuild.yaml
configuration file that runs Cirrus Tasks using CLI:
steps:
- name: 'cirrusci/cirrus-cli'
args: ['run']
env: ['CI=true']
If you want to use Cloud Storage as a cache, Cirrus Labs provides a reference HTTP proxy implementation that transparently forwards all cache operations to the specified bucket.
Here's a modified version of the example above that stores cache entries in the bucket named change-me
:
steps:
- name: 'docker'
args:
- 'run'
- '-d'
- '--name=gsp'
- '--network=cloudbuild'
- '--expose=80'
- 'cirrusci/google-storage-proxy:latest'
- '-address=0.0.0.0'
- '-port=80'
- '-bucket=change-me'
- name: 'cirrusci/cirrus-cli'
args: ['run', '--environment', 'CIRRUS_HTTP_CACHE_HOST=gsp']
env: ['CI=true']
You can further configure lifecycle rules to automatically delete outdated cache objects.
Cirrus CLI uses the same configuration format as Cirrus CI and no additional configuration is required.