# CircleCI integration

Integrations / CI. Breadcrumb: [Home](https://osty.dev/) / [Integrations](https://osty.dev/integrations) / CircleCI

CircleCI jobs run the same two Osty commands as any CI. `osty verify` gates the lockfile against signed verdicts, and `osty stamp` signs provenance after the image push. When `CIRCLECI=true`, the stamp reads project, commit, workflow ID and build URL from CircleCI's own environment, so the step needs only a digest and a key.

Table: CircleCI variables `osty stamp` reads when `CIRCLECI=true`

| Attestation field | CircleCI variable | Fallback | Override flag |
| --- | --- | --- | --- |
| Repository | `CIRCLE_PROJECT_USERNAME` / `CIRCLE_PROJECT_REPONAME` | Empty, which fails validation | `--repo` |
| Commit | `CIRCLE_SHA1` | None | `--commit-sha` |
| CI run ID | `CIRCLE_WORKFLOW_ID` | `CIRCLE_BUILD_NUM` | `--ci-run-id` |
| CI run URL | `CIRCLE_BUILD_URL` | None | `--ci-run-url` |
| CI provider | Set to `CIRCLECI` | None | `--ci-provider` |
| Forge | `GITHUB` by default | None | `--forge GITLAB` |

Gate the lockfile in a CircleCI job:

```bash
osty verify --lockfile package-lock.json --json
```

## How do I add Osty to .circleci/config.yml?

The verify job runs on a self-hosted machine runner in resource class `acme/osty-edge`, where `osty` is installed and the edge cache is readable. The build job runs on CircleCI's cloud, pushes the image and stamps it with a key from the `osty-signing` context.

`.circleci/config.yml`:

```yaml
version: 2.1

jobs:
  osty-verify:
    machine: true
    resource_class: acme/osty-edge
    environment:
      OSTY_EDGE_CACHE: /var/lib/osty/edge-cache.sqlite
      OSTY_POLICY_PATH: .osty/policy.yaml
    steps:
      - checkout
      - run:
          name: Validate policy
          command: osty policy validate .osty/policy.yaml
      - run:
          name: Verify lockfile against signed verdicts
          command: osty verify --lockfile package-lock.json --json
  build-and-stamp:
    docker:
      - image: cimg/go:1.26
    steps:
      - checkout
      - setup_remote_docker
      - run:
          name: Install osty
          command: CGO_ENABLED=0 go install github.com/osty-io/osty/cmd/osty@latest
      - run:
          name: Build and push image
          command: |
            docker build -t "ghcr.io/acme/api:${CIRCLE_SHA1}" .
            docker push "ghcr.io/acme/api:${CIRCLE_SHA1}"
            docker inspect --format '{{index .RepoDigests 0}}' "ghcr.io/acme/api:${CIRCLE_SHA1}" | cut -d@ -f2 > image.digest
      - run:
          name: Stamp provenance
          command: |
            printf '%s\n' "$OSTY_STAMP_KEY" > /tmp/stamp.pem
            osty stamp --artifact-digest "$(cat image.digest)" --signing-key /tmp/stamp.pem --out provenance.json
      - store_artifacts:
          path: provenance.json

workflows:
  supply-chain:
    jobs:
      - osty-verify
      - build-and-stamp:
          requires: [osty-verify]
          context: osty-signing
          filters:
            branches:
              only: main
```

## How do I check the attestation the job produced?

Download `provenance.json` from the job artifacts and verify it against the public key. The output lists every signed field.

Offline verification:

```bash
osty stamp verify --attestation provenance.json --public-key stamp.pub.pem
```

Example output:

```text
verified provenance attestation
  key_id               sha256:6944ed0d90df17bdbb7bfc035e501967a7bbf154c56b8fd26c6f0b6eba5d3317
  artifact_digest      sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  repository           GITHUB:acme/api
  commit_sha           0123456789abcdef0123456789abcdef01234567
  ci_provider          CIRCLECI
  ci_run_id            wf-1
  ci_run_url           https://app.circleci.com/x
  deployed_at          2026-11-29T19:40:13Z
```

## How does Osty classify this config?

Table: Classifier output for the `.circleci/config.yml` on this page

| Job | Class | Reasons reported |
| --- | --- | --- |
| `osty-verify` | `SIDE_EFFECT_POSSIBLE` | `osty policy validate` and `osty verify` are opaque run commands. |
| `build-and-stamp` | `SIDE_EFFECT_CONFIRMED` | `docker push` and shell output redirection. |

Because one job is `SIDE_EFFECT_CONFIRMED`, Osty never triggers this config speculatively. Split verification into its own config or workflow and allowlist it in `ciGovernor.safeVerifyWorkflows` if you want remote speculative runs.

## Frequently asked questions

### Does `osty stamp` work for CircleCI projects hosted on GitLab?

Yes. Pass `--forge GITLAB`, because CircleCI detection defaults the forge to GitHub.

### Why a self-hosted runner for the verify job?

It needs the signed verdict cache. On cloud executors, import a signed archive with `osty airgap import` first.

### Where should the signing key live?

In a restricted CircleCI context such as `osty-signing`, attached only to jobs on `main`.

## Related pages

- [GitHub Actions integration](https://osty.dev/integrations/github-actions): The same gate and stamp in a GitHub workflow.
- [See](https://osty.dev/see): Runtime-to-source lineage, `osty stamp` provenance, stale deploy detection, ghost production workloads and native-compiler reachability.
- [Guard](https://osty.dev/guard): Pre-install supply-chain firewall: Firecracker honey-secret detonation, artifact-vs-Git diffs, behavior baselines, dependency-confusion defense and `osty-proxy`.
- [Chainguard integration](https://osty.dev/integrations/chainguard): Record base-image digests with `--base-image-digest`.

## See your fleet in 10 minutes

Connect a read-only GitHub App and cloud role. Osty installs nothing in your environment and writes nothing to your repositories, and the report shows false positives, stale deploys and unowned workloads.

Get a free X-Ray: https://osty.dev/xray

Written by Osty Engineering. Published 2026-11-29. Updated 2026-11-29.

Canonical: https://osty.dev/integrations/circleci
