Using in CI/CD¶
Run gitlab-compliance in your pipeline so policy violations fail before merge.
- GitLab CI/CD:
- Project-level jobs, shared templates, reports, rollout
- GitLab Functions:
- Experimental
run:/func:example for check + generate docs - Pipeline Execution Policy:
- Org-wide injection via GitLab security policies
Typical compliance workflow:
- Copy or reference policies from
examples/example-policies/security/ - Add a compliance job (or inject one via Pipeline Execution Policy)
- Run
gitlab-compliance check -f policies/security/ -p .gitlab-ci.yml - Optionally pass
--projectfor API checks and--format codequalityfor GitLab reports - Fail the job on non-zero exit code
You can also generate pipeline documentation in CI with
generate and attach the output as a workflow
artifact (recommended on GitHub so pipeline details stay private):
gitlab-compliance generate -i .gitlab-ci.yml --format html -o pipeline-reference/index.html
Example policies: Examples. Sample generated docs: GitLab Docs output example.