Skip to content

Integrations / CI

GitLab CI integration

In GitLab CI, osty verify runs as one job that fails on blocked or unvetted dependencies. Osty also classifies .gitlab-ci.yml with Ruby Psych semantics, resolving merge keys, extends:, !reference and include:, so a speculative pipeline that could deploy, publish or release is never triggered. Unresolvable composition always fails safe.

Written by Osty EngineeringPublished Updated

How the classifier treats GitLab composition (ADR-0030)
ConstructHow Osty resolves itLowest possible class
<< merge keysApplied in document order with Psych semantics; earlier mappings win in a merge sequence.Depends on the merged job.
extends:Deep merge up to GitLab's 11-level limit; cycles and missing targets escalate.SIDE_EFFECT_POSSIBLE on any error.
!referenceResolved up to 10 nesting levels; referenced scripts are classified, never dropped.SIDE_EFFECT_POSSIBLE if unresolved.
include:Content is outside the file, so an <include> pseudo job is created.SIDE_EFFECT_POSSIBLE; SIDE_EFFECT_CONFIRMED for deploy or release targets.
Deploy-like stagesStage names containing deploy, release, publish, production, rollout or promote escalate unverified commands.SIDE_EFFECT_CONFIRMED.
environment:, release:, pagesStarting or stopping an environment, releases and Pages jobs.SIDE_EFFECT_CONFIRMED.
The GitLab job's gate command
osty verify --lockfile package-lock.json --json

How do I add osty verify to .gitlab-ci.yml?

Run the job on a runner tagged osty-edge that mounts the edge verdict cache. The pipeline below also contains the composition patterns the classifier has to see through.

.gitlab-ci.ymlyaml
stages:
  - verify
  - test
  - release
  - deploy

include:
  - project: acme/ci-templates
    file: /templates/security.yml

.go-defaults: &go-defaults
  image: golang:1.26
  before_script:
    - go version

.release-script:
  script:
    - ./scripts/publish.sh

osty-verify:
  stage: verify
  image: golang:1.26
  tags: [osty-edge]
  variables:
    OSTY_EDGE_CACHE: /var/lib/osty/edge-cache.sqlite
    OSTY_POLICY_PATH: .osty/policy.yaml
  script:
    - CGO_ENABLED=0 go install github.com/osty-io/osty/cmd/osty@latest
    - osty policy validate .osty/policy.yaml
    - osty verify --lockfile package-lock.json --json

unit-tests:
  <<: *go-defaults
  stage: test
  script:
    - go test ./...

lint:
  extends: .go-defaults
  stage: test
  script:
    - go vet ./...

publish:
  stage: release
  script:
    - !reference [.release-script, script]

deploy-production:
  stage: deploy
  image: alpine/helm:3.16.2
  environment:
    name: production
  script:
    - helm upgrade --install api ./chart

What does Osty report for this pipeline?

These are the classifier's real results for the file above. The pipeline as a whole is SIDE_EFFECT_CONFIRMED, so Osty never triggers it speculatively and verifies the change locally instead.

Classifier output for the .gitlab-ci.yml on this page
JobClassReason reported
<include>SIDE_EFFECT_POSSIBLEinclude project:acme/ci-templates:/templates/security.yml is not part of this file.
osty-verifySIDE_EFFECT_POSSIBLEThe go install script line is an opaque command.
unit-testsSIDE_EFFECT_POSSIBLEThe merged before_script line go version is opaque.
lintSIDE_EFFECT_POSSIBLEgo version arrives through extends: .go-defaults.
publishSIDE_EFFECT_CONFIRMED!reference resolves to ./scripts/publish.sh in the release stage.
deploy-productionSIDE_EFFECT_CONFIRMEDDeploys to environment production and runs helm upgrade.

Rules, only, except and when: manual are not evaluated, so a deploy job that would be skipped on a speculative branch is still counted.

Does osty stamp work in GitLab CI?

Not yet. osty stamp accepts GITHUB_ACTIONS and CIRCLECI as CI providers and rejects any other value, so GitLab pipelines cannot sign provenance today. Until then, Osty links GitLab workloads to commits through its pre-stamp lineage cascade, and reports workloads it cannot prove as missing provenance rather than guessing.

Current behavior when a GitLab provider is passedtext
osty stamp: invalid provenance statement: ci_provider "GITLAB_CI" must be one of GITHUB_ACTIONS, CIRCLECI

How does osty-edge connect to GitLab?

The edge runtime config selects GitLab with forge.provider: gitlab and ci.provider: GITLAB_CI. One REST v4 client serves both, against gitlab.com or a self-managed instance. Mutating requests are never retried after a 5xx, because GitLab may already have applied the commit or merge.

Frequently asked questions

Does Osty support self-managed GitLab?

Yes. The base URL may be the instance root or end in /api/v4.

Why is a pipeline built mostly from include: never PURE_VERIFY?

Included content is not in the classified file, so Osty cannot prove it side-effect free. Allowlist it in ciGovernor.safeVerifyWorkflows after review.

What happens with duplicate YAML keys?

Osty keeps the last value as Psych does, and marks the job SIDE_EFFECT_POSSIBLE because the intended definition is ambiguous.

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.