Complete guide to using batch manifests for selective model builds in CI/CD pipelines.
Batch build mode enables selective builds with per-model configuration through a JSON manifest file. This is ideal for CI/CD pipelines where you need fine-grained control over which models to rebuild.
madengine build --batch-manifest examples/build-manifest/batch.json \
--additional-context '{"gpu_vendor": "AMD", "guest_os": "UBUNTU"}'[
{
"model_name": "model1",
"build_new": true,
"registry": "docker.io/myorg",
"registry_image": "myorg/model1"
},
{
"model_name": "model2",
"build_new": false
}
]| Field | Type | Description |
|---|---|---|
model_name |
string | Model tag to include in manifest |
| Field | Type | Default | Description |
|---|---|---|---|
build_new |
boolean | false |
true: Build from sourcefalse: Reference existing image |
registry |
string | - | Per-model Docker registry (overrides global --registry) |
registry_image |
string | - | Custom registry image name/namespace |
- Models with
"build_new": trueare built from source - Models with
"build_new": falseare referenced without building - All models are included in the output
build_manifest.json
Each model can specify its own registry:
[
{
"model_name": "public_model",
"build_new": true,
"registry": "docker.io/myorg"
},
{
"model_name": "private_model",
"build_new": true,
"registry": "gcr.io/myproject"
}
]Cannot use --batch-manifest and --tags together:
# ❌ Error
madengine build --batch-manifest batch.json --tags model1
# ✅ Correct
madengine build --batch-manifest batch.jsonRebuild only changed models while referencing stable ones:
Example: examples/build-manifest/ci_incremental.json
[
{"model_name": "changed_model", "build_new": true},
{"model_name": "stable_model_1", "build_new": false},
{"model_name": "stable_model_2", "build_new": false}
]Usage:
madengine build --batch-manifest examples/build-manifest/ci_incremental.json \
--registry docker.io/myorg \
--additional-context-file config.jsonDeploy models to different registries:
[
{
"model_name": "public_model",
"build_new": true,
"registry": "docker.io/myorg"
},
{
"model_name": "private_model",
"build_new": true,
"registry": "gcr.io/myproject"
}
]Specify custom image names and tags:
[
{
"model_name": "my_model",
"build_new": true,
"registry": "docker.io/myorg",
"registry_image": "myorg/custom-name:v2.0"
}
]cat > my_batch.json << 'EOF'
[
{
"model_name": "dummy",
"build_new": true
},
{
"model_name": "stable_model",
"build_new": false,
"registry": "docker.io/myorg",
"registry_image": "myorg/stable:v1.0"
}
]
EOFmadengine build --batch-manifest my_batch.json \
--registry localhost:5000 \
--additional-context '{
"gpu_vendor": "AMD",
"guest_os": "UBUNTU"
}' \
--verboseThe command generates build_manifest.json containing:
- Built models with their new image names
- Referenced models with their existing image names
- Per-model registry configuration
Run the models:
madengine run --manifest-file build_manifest.jsonSee examples/build-manifest/ directory for:
batch.json- Basic example with all field typesci_incremental.json- CI/CD incremental build pattern
madengine build [OPTIONS]Batch Build Options:
--batch-manifest PATH- Input batch manifest file (mutually exclusive with--tags)--registry, -r URL- Global Docker registry (can be overridden per model)--additional-context, -c JSON- Configuration as JSON string--additional-context-file, -f PATH- Configuration file--manifest-output, -m PATH- Output manifest file (default:build_manifest.json)--verbose, -v- Verbose logging
Creates build_manifest.json with:
{
"built_images": {
"image_name": {
"docker_image": "...",
"registry": "...",
...
}
},
"built_models": {...},
"deployment_config": {...},
"summary": {...}
}- Version Control: Keep batch manifests in version control for reproducibility
- Start Simple: Begin with basic manifests and add complexity as needed
- Test Locally: Validate batch manifests locally before CI/CD deployment
- Consistent Naming: Use descriptive model names and consistent registry paths
- Document Changes: Add comments in commit messages explaining manifest changes
- Configuration Guide - Additional context and build arguments
- Usage Guide - General build and run workflows
- Deployment Guide - Kubernetes and SLURM deployment