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
| Construct | How Osty resolves it | Lowest possible class |
|---|---|---|
<< merge keys | Applied 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. |
!reference | Resolved 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 stages | Stage names containing deploy, release, publish, production, rollout or promote escalate unverified commands. | SIDE_EFFECT_CONFIRMED. |
environment:, release:, pages | Starting or stopping an environment, releases and Pages jobs. | SIDE_EFFECT_CONFIRMED. |
osty verify --lockfile package-lock.json --jsonHow 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.ymlyamlstages:
- 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 ./chartWhat 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.
| Job | Class | Reason reported |
|---|---|---|
<include> | SIDE_EFFECT_POSSIBLE | include project:acme/ci-templates:/templates/security.yml is not part of this file. |
osty-verify | SIDE_EFFECT_POSSIBLE | The go install script line is an opaque command. |
unit-tests | SIDE_EFFECT_POSSIBLE | The merged before_script line go version is opaque. |
lint | SIDE_EFFECT_POSSIBLE | go version arrives through extends: .go-defaults. |
publish | SIDE_EFFECT_CONFIRMED | !reference resolves to ./scripts/publish.sh in the release stage. |
deploy-production | SIDE_EFFECT_CONFIRMED | Deploys 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.
osty stamp: invalid provenance statement: ci_provider "GITLAB_CI" must be one of GITHUB_ACTIONS, CIRCLECIHow 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.