Pipeline models¶
gcip2.pipeline_core provides typed Pydantic models describing GitLab CI/CD pipelines.
It is the data layer that the builders assemble — nothing here reads
configuration or writes files.
Models¶
Model |
Describes |
|---|---|
|
Root object: stages, jobs, workflow, defaults, variables, includes |
|
A single job and the full set of supported job attributes |
|
Pipeline-level workflow configuration and rules |
|
Downstream and child pipeline configuration |
|
Job artifacts and reports |
|
Job dependencies |
|
Container image and service configuration |
|
Settings inherited by every job |
|
Pipeline-level and job-level variables |
Full field documentation is generated in the API reference.
Serialisation¶
All models inherit a shared BaseModel that adds dump():
pipeline.dump()
The result is ready for YAML output:
Nonevalues are excluded;fields left at their default are excluded;
GitLab aliases are used, so
if_is emitted asif;values render in JSON mode, so enums become their string values.
Excluding defaults keeps generated YAML close to what a person would have written by hand, which matters because every build logs a diff against the previous version.
Validation¶
pipeline.validate_pipeline()
Validates the serialised pipeline against the bundled GitLab CI JSON schema and raises
jsonschema.ValidationError when the structure is invalid — catching unknown keywords,
wrong types, and malformed rules before GitLab sees them.