CI/CD Integration

Push images to Clipper from your CI pipeline.

GitHub Actions

1. Store credentials as a secret

Create a token with image:push, image:pull, and repo:create scopes. Then add it as a GitHub secret:

  • Go to Settings > Secrets and variables > Actions
  • Name: CLIPPER_CREDENTIALS
  • Value:
{"registries":{"clipper.dev":{"token":"clp_your_token_here"}}}

2. Add to your workflow

name: Build and Push
 
on:
  push:
    branches: [main]
 
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
 
      - name: Build image
        run: docker build -t myapp:${{ github.sha }} .
 
      - uses: clipper-registry/setup-clipper@v1
 
      - name: Push to Clipper
        run: |
          echo '${{ secrets.CLIPPER_CREDENTIALS }}' > /tmp/clipper-creds.json
          export CLIPPER_CREDENTIALS_FILE=/tmp/clipper-creds.json
          clipper push myapp:${{ github.sha }} clipper.dev/myorg/myapp:${{ github.sha }}
          clipper push myapp:${{ github.sha }} clipper.dev/myorg/myapp:latest

Running tests inside a Clipper image

Use the Clipper Runner to run GitHub Actions steps inside a Clipper image via container: jobs:

jobs:
  test:
    runs-on: ubuntu-latest
    container:
      image: clipperregistry/runner:latest
      env:
        CLIPPER_MAGIC_IMAGE: clipper.dev/myorg/myapp:latest
        CLIPPER_CREDENTIALS: ${{ secrets.CLIPPER_CREDENTIALS }}
    steps:
      - name: Download and unpack clipper image
        run: /.clipper-runner/github-init
      - run: make test

Other CI systems

The same approach works anywhere: write the credentials JSON to a file and set CLIPPER_CREDENTIALS_FILE. See Authentication for the file format.