Metadata-Version: 2.5
Name: gcip2
Version: 0.2.2
Summary: framework for dynamic pipeline generation from python code
Author: PivLab Dev
Author-email: Arsenii Nikulin <a.nikulin@pivlab.dev>
License-Expression: MIT
License-File: LICENCE.md
Requires-Python: <4.0,>=3.11
Requires-Dist: click<9.0.0,>=8.4.1
Requires-Dist: gitpython<4.0.0,>=3.1.57
Requires-Dist: hvac<3.0.0,>=2.4.0
Requires-Dist: injector>=0.24.0
Requires-Dist: jsonschema<5.0.0,>=4.26.0
Requires-Dist: keyring>=25.7.0
Requires-Dist: loguru<1.0.0,>=0.7.3
Requires-Dist: pydantic<3.0.0,>=2.13.4
Requires-Dist: pyyaml<7.0.0,>=6.0.3
Description-Content-Type: text/markdown

# 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

Create `pyproject.toml` with pyproject configuration

```
[project]
name = "dev"
version = "0.0.0"
description = ""
requires-python = ">=3.11,<4.0"

```

```bash
uv add gcip2
```

---

# Quick Start

Initialize a new project:

```bash
dothat run init
```

This generates a minimal project structure:

```text
.
├── ci.py
├── pyproject.toml
├── environment.toml
└── .pre-commit-config.yaml
```

Generate a child pipeline:

```bash
dothat run build-pipeline
```

or explicitly:

```bash
dothat run build-pipeline \
    --ci-file ci.py \
    --out-pipeline out/pipeline.gitlab-ci.yml
```

Generate the root `.gitlab-ci.yml`:

```bash
dothat run build-gitlab-ci
```

or

```bash
dothat run build-gitlab-ci \
    --ci-file ci.py \
    --out-gitlab-ci .gitlab-ci.yml
```

---

# Project Structure

A typical project consists of two builders:

```text
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.

---

# 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](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](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](https://docs.gitlab.com/ci/pipeline_editor/#view-full-configuration)
