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 syntax and structural errors
- Include Resolution: Recursively processes all included YAML files
- Job Expansion: Properly expands jobs according to the
extendsmechanism - 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
Installation
pip install cimulator
Or with Poetry:
poetry add cimulator
Basic Usage
# 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
# Simulate a pipeline run for a specific event (merge request)
cimulator simulate path/to/your/.gitlab-ci.yml --event merge_request
# Get detailed output
cimulator simulate path/to/your/.gitlab-ci.yml --verbose
Example
Given a GitLab CI configuration:
# .gitlab-ci.yml
stages:
- build
- test
- deploy
build:
stage: build
script: echo "Building..."
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: never
- when: always
test:
stage: test
script: echo "Testing..."
needs: [build]
deploy:
stage: deploy
script: echo "Deploying..."
needs: [test]
rules:
- if: $CI_COMMIT_BRANCH == "main"
when: on_success
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cimulator-0.1.0.tar.gz.
File metadata
- Download URL: cimulator-0.1.0.tar.gz
- Upload date:
- Size: 37.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.13.2 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90255351114424ea17c420dcd12c4846f135aca5bffe379158489e2e4cf1793c
|
|
| MD5 |
899d8b3d8e1629b616e38f7403fd613b
|
|
| BLAKE2b-256 |
054e1de0f3f75b3214dc6df5d165dacdc545912fe1e078398a9a1b7858795665
|
File details
Details for the file cimulator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cimulator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.13.2 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aacd386d3360379adb61f5440045205445560fda95e494c8cb38e1dc23b4b1b7
|
|
| MD5 |
7b49bda4dcbed4e03f7a93ec32812b9a
|
|
| BLAKE2b-256 |
41d863a95b45a68e4050f087750aef570d9d30a639af4a2a7c5cdbca79ed5e3c
|