Skip to main content

Documentation 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.

Melange ships an extensive library of reusable pipelines that cover the most common packaging tasks — downloading sources, applying patches, stripping debug symbols, and running ecosystem-specific build tools. These pipelines live in the pkg/build/pipelines/ directory of the melange repository and are available to every build without any additional configuration.

How built-in pipelines are located

A pipeline is invoked by its path relative to the pkg/build/pipelines/ directory, without the .yaml extension. For a pipeline stored at pkg/build/pipelines/go/build.yaml you write:
pipeline:
  - uses: go/build
    with:
      packages: .
      output: mybinary
For a top-level pipeline like pkg/build/pipelines/fetch.yaml you simply write:
pipeline:
  - uses: fetch
    with:
      uri: https://example.com/source-1.0.tar.gz
      expected-sha256: <hash>
To list every available pipeline, browse the pkg/build/pipelines/ tree in the melange repository or run find $(go env GOPATH)/pkg/mod/chainguard.dev/melange*/pkg/build/pipelines -name '*.yaml' after installing melange locally.

Pipeline categories

CategoryPath prefixPurpose
General(top-level)Fetch, patch, strip, git operations
autoconfautoconf/GNU Autotools configure / make builds
cargocargo/Rust / Cargo builds
cmakecmake/CMake configure and build
gogo/Go compiler builds and dependency bumps
llvmllvm/LLVM-based toolchain builds
mavenmaven/Java / Maven builds
mesonmeson/Meson build system
npmnpm/Node.js / npm installs
peclpecl/PHP PECL extension builds
perlperl/Perl module builds
pythonpython/Python package builds
RR/R package builds (CRAN)
rubyruby/RubyGems builds
splitsplit/Package splitting helpers (bin, lib, dev, …)

Commonly used pipelines

fetch

Downloads a source archive from a URI, verifies its checksum, and extracts it into the workspace. This is the most common way to get upstream source tarballs. Required packages: wget
InputDefaultDescription
uri(required)URI to download
expected-sha256Expected SHA-256 checksum
expected-sha512Expected SHA-512 checksum
expected-noneSet to skip checksum verification
strip-components1Tar --strip-components value
directory.Target extraction directory
extracttrueWhether to untar the download
deletefalseDelete the archive after extraction
timeout5Connect/read timeout in seconds
dns-timeout20DNS lookup timeout in seconds
retry-limit5Number of download retries
purl-name${{package.name}}PURL name for SBOM generation
purl-version${{package.version}}PURL version for SBOM generation
reasonHuman-readable reason for using fetch instead of git-checkout
Either expected-sha256, expected-sha512, or expected-none must be set. Builds fail if none of these are provided, ensuring supply-chain integrity.
Example:
- uses: fetch
  with:
    uri: https://mirrors.ocf.berkeley.edu/gnu/hello/hello-${{package.version}}.tar.gz
    expected-sha256: cf04af86dc085268c5f4470fbae49b18afbc221b78096aab842d934a76bad0ab

patch

Applies one or more patch files to the workspace sources using the patch command. Patch files must be placed in the source directory alongside your melange YAML. Required packages: patch
InputDefaultDescription
patchesWhitespace-delimited list of patch files
seriesPath to a quilt-style series file
strip-components1Strip components passed to patch -p
fuzz2Maximum fuzz factor for context diffs
Either patches or series must be provided. They are mutually exclusive — if both are set, series takes precedence.
Example:
- uses: patch
  with:
    patches: fix-build-on-musl.patch disable-tests.patch

strip

Strips debug symbols from all ELF binaries and shared libraries in the package staging directory. This reduces APK size significantly for compiled packages. Required packages: binutils, scanelf
InputDefaultDescription
opts-gFlags passed to the strip command
The pipeline uses scanelf to enumerate all ET_DYN and ET_EXEC ELF files under ${{targets.contextdir}} and strips only native-architecture binaries (x86_64 or aarch64). Example:
- uses: strip

git-checkout

Clones a git repository into the workspace. Supports shallow clones, branch or tag pinning, commit verification, cherry-picks, submodules, and sparse checkout. See the Git Pipelines page for full documentation. Required packages: git Example:
- uses: git-checkout
  with:
    repository: https://github.com/puerco/hello.git
    tag: v${{package.version}}
    expected-commit: a73c4feb284dc6ed1e5758740f717f99dcd4c9d7

git-am

Applies one or more patch files to a git repository using git am. This is an alternative to the patch pipeline for repositories checked out with git-checkout. Required packages: git
InputDefaultDescription
patches(required)Whitespace-delimited list of patch files
Patch paths are resolved relative to the workspace root — the same directory where melange copies files from --source-dir. This assumes git-checkout used the default destination (.), so the workspace root is the git repository. Example:
- uses: git-am
  with:
    patches: 0001-fix-cve.patch 0002-backport.patch

Ecosystem pipeline quick reference

The autoconf/ pipelines wrap the standard ./configure && make && make install workflow:
  • autoconf/configure — runs ./configure with common flags
  • autoconf/make — runs make
  • autoconf/make-install — runs make install into ${{targets.destdir}}
- uses: autoconf/configure
- uses: autoconf/make
- uses: autoconf/make-install
The cmake/ pipelines configure and build CMake-based projects:
  • cmake/configure — runs cmake with standard flags
  • cmake/build — runs cmake --build
  • cmake/install — installs to staging directory
- uses: cmake/configure
- uses: cmake/build
- uses: cmake/install
The meson/ pipelines wrap Meson and Ninja:
  • meson/configure — runs meson setup
  • meson/compile — runs ninja
  • meson/install — runs ninja install
- uses: meson/configure
- uses: meson/compile
- uses: meson/install
The split/ pipelines extract subsets of installed files into sub-packages:
  • split/bin — moves usr/bin contents to a sub-package
  • split/dev — moves headers and static libraries
  • split/lib — moves shared libraries
  • split/manpages — moves man pages
  • split/debug — moves debug symbols
  • split/static — moves .a static libraries
  • split/locales — moves locale data
subpackages:
  - name: hello-dev
    pipeline:
      - uses: split/dev
The python/ pipelines handle Python builds and installs, typically using setuptools or pip.
- uses: python/build-installer
The perl/ pipelines handle Makefile.PL and Build.PL based Perl module builds.
- uses: perl/makefile

Adding new built-in pipelines

New built-in pipelines are created by adding YAML files to the pkg/build/pipelines/ directory and rebuilding melange. To test locally before submitting a pull request, install a development version with:
go install .
For CI pipeline builds, bump the melange dependency in wolfictl:
go get chainguard.dev/melange@main
go mod tidy
For pipelines that don’t belong in the upstream repository, use the --pipeline-dir flag to load them from a local directory. See Custom Pipelines for details.

Build docs developers (and LLMs) love