Melange’s built-in pipelines cover the most common packaging workflows, but every software ecosystem has its own quirks. Custom pipelines let you encapsulate repeated build logic into reusable YAML files that work exactly like built-in pipelines — you invoke them withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/chainguard-dev/melange/llms.txt
Use this file to discover all available pages before exploring further.
uses:, pass inputs with with:, and gate execution with if:. The only difference is that you tell melange where to find them using the --pipeline-dir flag.
Defining a custom pipeline
A custom pipeline is a YAML file with the same structure as a built-in pipeline. At minimum it has apipeline: section containing one or more steps. Optionally it declares inputs: to accept parameters from the caller.
File name = pipeline name
Melange maps a pipeline’s file path (relative to the pipeline directory, without.yaml) to its uses: name. A file named conditional.yaml in your custom pipeline directory is invoked as:
myorg/deploy.yaml would be invoked as:
Custom pipeline structure
The conditional.yaml example
The examples/conditional.yaml file in the melange repository shows how to combine if: expressions, sub-pipelines with assertions:, and uses: conditionals in a single build:
Pointing melange to your custom pipelines
Once your custom pipeline file exists on disk, pass its parent directory to melange using the--pipeline-dir flag. You can specify the flag multiple times to load pipelines from several directories.
Melange searches
--pipeline-dir directories before the built-in pipeline path. If you create a file named fetch.yaml in your custom directory, it will shadow the built-in fetch pipeline. Use unique names (such as namespaced subdirectories) to avoid accidental overrides.Writing a custom pipeline with inputs
Custom pipelines accept typed inputs from the caller through theinputs: block. Each input can have a description, a default value, and a required flag.
The following example defines a custom pipeline that installs a pre-compiled binary from a well-known staging directory:
Adding new built-in pipelines
If your custom pipeline is broadly useful and belongs upstream, you can contribute it to the melange repository by adding a YAML file topkg/build/pipelines/. After adding the file, rebuild melange locally to test it:
Write the pipeline YAML
Create your pipeline file in
pkg/build/pipelines/ (or a subdirectory for a new ecosystem). Follow the same inputs: / pipeline: structure used by existing pipelines.Rebuild melange
Run
go install . from the repository root to install a development build that includes your new pipeline.Test your pipeline
Write a test melange YAML that invokes your pipeline and run
melange build against it to verify the behaviour.