Skip to main content

A tool to validate and simulate GitLab CI pipelines

Project description

Cimulator

A tool to validate and simulate GitLab CI pipelines without running them.

Overview

Cimulator is a Python tool designed to validate and simulate GitLab CI pipelines. It addresses the challenge of testing and validating complex CI/CD configurations without having to commit changes to a repository and wait for actual pipeline runs.

Features

  • Configuration Validation: Validates GitLab CI YAML files for non-existent jobs
  • Include Resolution: Recursively processes all included YAML files
  • Job Expansion: Properly expands jobs according to the extends mechanism
  • Rule Evaluation: Evaluates workflow and job rules to determine which jobs would run
  • Variable Interpolation: Simulates how variables are expanded in different contexts
  • Pipeline Simulation: Provides a "dry run" of what a pipeline would look like

Limitations

  • YAML correctness check is pretty basic: cimulator checks only for the references jobs that don't exist. YAML syntax correctness shall be done using the proper tools.
  • It's design to be 100% offline. It means the references to the files and jobs from other repositories are not resolved. They don't prevent cimulator from running, though.
  • In some cases you can still see incorrect variable expansion in the simulation output file. This is WIP.

Installation

pip install cimulator

Or with uv:

uv add cimulator

Basic Usage

There are to commands: validate and simulate. Validation checks that all jobs references in needs and extends exist. Simulation is a more in-depth action, that considers the variables that the pipeline will be run upon, including the built-in Gitlab CI variables, resolves the rules and produces an output simulations file that contains:

  • List of jobs that will be run
  • Jobs seen as by Gitlab, i.e. with resolved extensions and variables.
# Validate a CI configuration file
cimulator validate path/to/your/.gitlab-ci.yml

# Simulate a pipeline run for the default branch
cimulator simulate path/to/your/.gitlab-ci.yml ci-config.yml profile

To simulate you will need a CI config file, which contains profiles for your CI. Typically you need to specify there the source of the pipeline and additional variables that you set in Gitlab CI.

Example

Consider the example CI in examples/complete.

You can validate and simulate this pipeline:

cimulator simulate examples/complete/.gitlab-ci.yml examples/complete/ci-config.yml MR
Root file: /Users/ibarkov/workspace/cimulator/examples/complete/.gitlab-ci.yml
Base path: /Users/ibarkov/workspace/cimulator/examples/complete

Warnings about job dependencies:
  - Job 'integration_test' needs job 'test_windows' which will not run in this pipeline
  - [Optional] Job 'test_mixed' needs job 'build_optnotrun' which will not run in this pipeline
Simulation successful. Output saved to /Users/ibarkov/workspace/cimulator/simulation_output.yml

License

MIT License - see the LICENSE file for details.

Project details


Download files

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

Source Distribution

cimulator-0.1.4.tar.gz (67.5 kB view details)

Uploaded Source

Built Distribution

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

cimulator-0.1.4-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file cimulator-0.1.4.tar.gz.

File metadata

  • Download URL: cimulator-0.1.4.tar.gz
  • Upload date:
  • Size: 67.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cimulator-0.1.4.tar.gz
Algorithm Hash digest
SHA256 64920418a33114580274d98fa7206ee3ea76dd6897dee6dd79872974eecfcbc7
MD5 f129c2146fb2dbb172ece5eddd114c68
BLAKE2b-256 f2e3d9d3e8a8560ea31e53e932a68c2095d3d75ed885ecc882566c31b3c50c28

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimulator-0.1.4.tar.gz:

Publisher: release.yml on Zvord/cimulator

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

File details

Details for the file cimulator-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: cimulator-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for cimulator-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 29830062d1977f82d9ae02e5568615918cc2505a83cf63244f09dfb3c473602e
MD5 ae44084c233c1f60c6fd7fc71089fe45
BLAKE2b-256 872f2d2de4fb59f720526f8c7ee3e616c527bc10c6da4439c45091b57ecc81c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimulator-0.1.4-py3-none-any.whl:

Publisher: release.yml on Zvord/cimulator

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

Supported by

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