Skip to main content

Module pipeline

Module pipeline 

Source
Expand description

Pipeline build support for building multiple images from a manifest

This module provides types and execution for ZPipeline.yaml files, which coordinate building multiple ZImagefiles with dependency ordering, shared caches, and coordinated pushing.

§Overview

A ZPipeline defines:

  • Global variables for template substitution (${VAR} syntax)
  • Default settings inherited by all image builds
  • Multiple images with optional dependency relationships
  • Push configuration for coordinated registry operations

§Execution Model

The PipelineExecutor builds images in “waves” based on dependency depth:

  • Wave 0: Images with no dependencies (run in parallel)
  • Wave 1: Images depending only on Wave 0 images
  • Wave N: Images depending only on earlier waves

§Example

version: "1"

vars:
  VERSION: "dev"
  REGISTRY: "ghcr.io/myorg"

defaults:
  format: oci
  build_args:
    RUST_VERSION: "1.90"

images:
  base:
    file: images/Dockerfile.base
    tags:
      - "${REGISTRY}/base:${VERSION}"
  app:
    file: images/Dockerfile.app
    depends_on: [base]
    tags:
      - "${REGISTRY}/app:${VERSION}"

push:
  after_all: true

§Usage

use zlayer_builder::pipeline::{PipelineExecutor, parse_pipeline};
use zlayer_builder::BuildahExecutor;
use std::path::PathBuf;

let yaml = std::fs::read_to_string("ZPipeline.yaml")?;
let pipeline = parse_pipeline(&yaml)?;

let executor = BuildahExecutor::new_async().await?;
let result = PipelineExecutor::new(pipeline, PathBuf::from("."), executor)
    .fail_fast(true)
    .run()
    .await?;

println!("Built {} images in {}ms", result.succeeded.len(), result.total_time_ms);

Re-exports§

pub use executor::PipelineExecutor;
pub use executor::PipelineResult;
pub use types::PipelineCacheConfig;
pub use types::PipelineDefaults;
pub use types::PipelineImage;
pub use types::PushConfig;
pub use types::ZPipeline;

Modules§

executor
Pipeline executor - Coordinates building multiple images with wave-based orchestration
types
ZPipeline types - YAML-based multi-image build pipeline format

Functions§

parse_pipeline
Parse a ZPipeline YAML file from its contents.