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 query reads a melange YAML configuration file and evaluates a Go template expression against it, printing the result to stdout. This lets you extract any field from a package config — name, version, epoch, dependencies, or any other structured data — without writing a dedicated YAML parser. The output is plain text, making it easy to consume in shell scripts, CI pipelines, and automation tooling.
Usage
.Package.Name, .Package.Version).
Examples
Template data model
The template receives the parsed melange config as its data object. Key top-level fields available in templates:| Template path | Type | Description |
|---|---|---|
.Package.Name | string | Package name |
.Package.Version | string | Package version |
.Package.Epoch | int | Package epoch |
.Package.Description | string | Short package description |
.Package.Dependencies.Runtime | []string | Runtime dependencies |
.Environment | struct | Build environment configuration |
.Pipeline | []struct | Build pipeline steps |
.Subpackages | []struct | Subpackage definitions |
The full data model mirrors the melange YAML schema. Any field that can appear in a melange YAML file can be accessed in a query template using Go template dot-notation.
Flags
melange query has no command-specific flags beyond the inherited global:
| Flag | Default | Description |
|---|---|---|
--log-level | INFO | Log verbosity: debug, info, warn, or error |
Shorthand: package-version
For the common case of printing the full package version string, themelange package-version command provides a convenient shorthand:
CI script usage
melange query is particularly useful in CI/CD workflows where build steps need to read metadata from the package config:
