Pipeline builder¶
PipelineBuilder turns a pipeline definition into a GitLab CI file: it loads the
definition, builds the typed model, renders it, and writes the result to disk.
It is obtained from the container, not constructed directly:
self._di.get(PipelineBuilder)
Entry points¶
Method |
Purpose |
|---|---|
|
Builds the root |
|
Builds a standalone child pipeline |
|
Imports a module and creates the first subclass of the requested builder type |
|
Converts a |
|
Serialises and writes the file |
Discovery¶
Pipeline definitions are ordinary Python modules. The builder imports the module and creates the first class inheriting from the requested base — no registration is needed:
class MyPipeline(PipelineBuilderImpl): ...
The class is created through the container, so it receives the project configuration along with everything else it declares.
Rendering¶
render_pipeline() transforms the model into the structure GitLab expects:
pipeline-level fields such as
workflow,stages, andvariablesstay at the root;each job becomes a top-level mapping keyed by its name;
a job without a name, or a duplicate name, is rejected.
Serialisation uses a custom YAML dumper that preserves key order, emits multiline strings as block scalars, and writes UTF-8 without escaping non-ASCII characters.
Output¶
Without an explicit path, pipelines are written to out/pipeline.gitlab-ci.yml.
Before writing, the builder logs a unified diff against the existing file. Unchanged files are reported as such, so regenerating configuration in review shows exactly what moved.