Configure a Spacelift push policy to ignore changes to non-IaC files

domain: docs.spacelift.io · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Create a new `Push` type policy in Spacelift; push policies receive a git push payload including changed file paths as `input.push.affected_files`.
  2. Write a Rego rule that checks whether any changed file matches a path prefix for IaC directories: `track { input.push.affected_files[_] == file; startswith(file, "infra/") }`.
  3. Add an `ignore` rule that fires when no IaC file is changed: `ignore { count([f | f := input.push.affected_files[_]; startswith(f, "infra/")]) == 0 }`.
  4. Attach the push policy to the target stack and push a commit that changes only a markdown file; confirm the run is ignored in the Spacelift UI.
  5. Test the policy logic in the Spacelift policy simulator before attaching it to production stacks.
  6. Combine with a `Trigger` policy to automatically start downstream stacks when a shared module changes.

Known gotchas

Related routes

Author a Spacelift stack with a Git push policy written in Rego that skips CI for changes only touching documentation files, and set a custom runner image
docs.spacelift.io · 5 steps · unrated
Enforce Terraform plan policies in Spacelift using a plan policy written in Rego
docs.spacelift.io · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans