GCIP2
GCIP2 is a Python DSL for building GitLab CI/CD pipelines using strongly typed Pydantic models and a fluent builder API.
Instead of writing large YAML files, pipelines are defined in Python, validated against the official GitLab CI schema, and rendered into GitLab-compatible YAML.
Features
- Strongly typed GitLab CI models
- Fluent builder API
- Reusable job builders
- Pipeline inheritance
- JSON Schema validation
- Automatic YAML generation
- Dynamic pipeline discovery
- GitLab-compatible output
Installation
poetry add gcip2
Quick Start
Initialize a new project:
gcip2 init
This generates a minimal project structure:
.
├── ci.py
├── pyproject.toml
├── poetry.toml
├── environment.toml
└── .pre-commit-config.yaml
Generate a child pipeline:
gcip2 build-pipeline
or explicitly:
gcip2 build-pipeline \
--ci-file ci.py \
--out-pipeline out/pipeline.gitlab-ci.yml
Generate the root .gitlab-ci.yml:
gcip2 build-gitlab-ci
or
gcip2 build-gitlab-ci \
--ci-file ci.py \
--out-gitlab-ci .gitlab-ci.yml
Documentation
Detailed documentation is available in the docs/ directory.
| Document | Description |
|---|---|
| docs/pipeline.md | Creating pipelines, jobs and workflow configuration |
| docs/builder.md | Pipeline builder, rendering and YAML generation |
| docs/pipeline_core.md | Reference for the typed GitLab CI models |
| CHANGELOG.md | Project changelog |
Project Structure
A typical project consists of two builders:
ci.py
├── Pipeline(PipelineBuilderImpl)
│ └── generates:
│ out/pipeline.gitlab-ci.yml
│
└── GitlabCi(GitlabCiBuilderImpl)
└── generates:
.gitlab-ci.yml
Pipeline defines the reusable downstream pipeline, while GitlabCi defines the repository's root GitLab CI configuration.
CLI
Initialize a project:
gcip2 init
Force regeneration of template files:
gcip2 init --force
Build a child pipeline:
gcip2 build-pipeline
Build the repository .gitlab-ci.yml:
gcip2 build-gitlab-ci
Validation
Generated pipelines can be validated against the bundled GitLab JSON schema before rendering.
External Links
- JSON Schema: https://json-schema.org/draft-07/json-schema-release-notes#keywords
- GitLab Pipeline Schema: https://gitlab.com/gitlab-org/gitlab-foss/-/raw/master/app/assets/javascripts/editor/schema/ci.json
- GitLab CI Documentation: https://docs.gitlab.com/ci/pipeline_editor/#view-full-configuration
License
Release files for gcip2 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gcip2-0.0.12.tar.gz | 34.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gcip2-0.0.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 75.1 kB
Release files / gcip2-0.0.12.tar.gz
| Download URL | gcip2-0.0.12.tar.gz |
|---|---|
| Size | 34.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cdfbaf5cbe78195e3def70b948172f385579bea5ecfce1761ad08936ce405a98
|
|
BLAKE2b-256 checksum How to use checksums |
f6c3646a301be086dfed0c473e75e85d4ad5dff8445a78480905d25aebfc2c29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.12 Linux/5.14.0-687.10.1.el9_8.0.1.x86_64
|
Release files / gcip2-0.0.12-py3-none-any.whl
| Download URL | gcip2-0.0.12-py3-none-any.whl |
|---|---|
| Size | 41.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8e6a5a62f618377b141b6404b0b63d478365eeff6284c71e93f8c785f130787
|
|
BLAKE2b-256 checksum How to use checksums |
d106b662d9ebd02d54eaad858150c404cf04056fc4405109c7586fc6127bee41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.12.12 Linux/5.14.0-687.10.1.el9_8.0.1.x86_64
|