Skip to main content

layout: home title: Overview permalink: /

Gitlab Compliance

Gitlab Compliance is a BDD compliance testing and documentation generation toolkit for GitLab CI/CD pipelines and project settings. It runs Gherkin policies against `.gitlab-ci.yml` and optional GitLab API settings. You can also generate markdown documentation for your Gitlab pipelines.

Source code - coming soon: MaturityBuilder/gitlab-compliance.

Get started

Get started{ .md-button .md-button-primary } Usage{ .md-button } BDD grammar{ .md-button }

gitlab-compliance supports two core workflows from the same pipeline YAML:

Workflow Command What it does
Compliance check Run Gherkin policies against .gitlab-ci.yml (and optional GitLab API settings)
Documentation generate Build Markdown, swagger-markdown, or HTML reference docs from .gitlab-ci.yml

gitlab-compliance check console demo

pip install gitlab-compliance

# Validate pipeline configuration against policies
gitlab-compliance check -f policies/ -p .gitlab-ci.yml

# Generate pipeline documentation (filter and group output as needed)
gitlab-compliance generate -i .gitlab-ci.yml --format swagger-markdown -o pipeline-reference.md
gitlab-compliance generate -i .gitlab-ci.yml --exclude variables,image --group-by stage

See Usage for the full CLI (including demos) and Generate pipeline documentation for output formats, --exclude, and --group-by.

  • compliance: Ensure pipeline YAML and project settings follow your security standards and custom policies
  • behaviour driven development: Policies are readable Gherkin scenarios that developers and security teams share
  • portable: Install from pip. See Installation
  • pre-merge: Validate configuration before changes land on protected branches
  • YAML and API: Offline checks against pipeline files; optional GitLab API checks for project settings and CI variables
  • easy to integrate: Run in GitLab CI or local git hooks
  • segregation of duty: Keep policy packs in a separate repository or OCI registry
  • documentation: Generate Markdown or HTML reference docs from .gitlab-ci.yml

Idea

gitlab-compliance focuses on negative testing — catching misconfigurations and policy violations — rather than proving that a job runs successfully end to end.

GitLab CI pipelines are defined in YAML that composes jobs, includes, variables, and workflow rules. What was missing is a lightweight way to assert that this configuration follows organizational standards before merge. GitLab offers native compliance features in higher tiers; gitlab-compliance provides an open, portable alternative inspired by terraform-compliance and Conftest.

For example, a policy might require that no job uses a floating latest image tag:

if a job defines an image, it must not use the :latest tag

translates into:

Given I have any job defined
When it has image
Then its image must not match ":latest$"

The image value comes from your pipeline YAML:

scan:
  image: python:3.12
build:
  image: docker:latest   # violates the policy above

In CI, this scenario runs against .gitlab-ci.yml (and resolved local includes) so merge requests cannot introduce violations.

See Examples for more sample use cases.

Supporting / Requirements

  • Python: 3.12 (see Installing via pip)
  • Pipeline file: .gitlab-ci.yml or another path passed with -p
  • API checks (optional): GitLab token plus --project or --group for settings and CI variable policies

Full CLI options: Usage. Step grammar: BDD Reference.

How can you support the project?

Contributions are welcome — see Contributing.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitlab_compliance-2.1.1.tar.gz (86.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitlab_compliance-2.1.1-py3-none-any.whl (110.0 kB view details)

Uploaded Python 3

File details

Details for the file gitlab_compliance-2.1.1.tar.gz.

File metadata

  • Download URL: gitlab_compliance-2.1.1.tar.gz
  • Upload date:
  • Size: 86.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for gitlab_compliance-2.1.1.tar.gz
Algorithm Hash digest
SHA256 ae8598c8404cf61a1709696e644f5e55261f92b5c5787b27546ee95551f44a0e
MD5 bda7575589b024e42dd50212cef91df2
BLAKE2b-256 c8dec6062d7c933ce065d9f7f0776daddbce8e31204371c90c4ca25d0ce66106

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitlab_compliance-2.1.1.tar.gz:

Publisher: release.yml on MaturityBuilder/gitlab-compliance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gitlab_compliance-2.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for gitlab_compliance-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eb9e0af5315f6abdaab504449800441782f5032a30482c3c7547cb9d49ebc278
MD5 a915e8bec5883468beb15bb48a88934b
BLAKE2b-256 11df1e2636a788bea0861ebb4e70e444735e4633f80b0234fff17a6bb0b170fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitlab_compliance-2.1.1-py3-none-any.whl:

Publisher: release.yml on MaturityBuilder/gitlab-compliance

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.5.0

2 files

2.4.0

2 files

2.3.0

2 files

2.2.0

2 files

This release

2.1.1 This release

2 files

2.1.0

2 files

2.0.1

2 files

2.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page