Create a bundle in Next mode
Create a self-contained OCI artifact from a bundle.uds.hcl definition.
What you’ll accomplish
Section titled “What you’ll accomplish”- Define package sources and dependencies.
- Add package values and bundle defaults.
- Create a signed artifact or an unsigned local test artifact.
Prerequisites
Section titled “Prerequisites”- UDS CLI installed
- A directory containing the bundle definition
- OCI access to each package source
- Public key files referenced by package verification policies
- A Cosign signing key or an OIDC identity when creating a signed artifact
-
Define the bundle
Create
bundle.uds.hcl:The
my-org, package names, package references, key paths, and signer identity below are placeholders. Replace them with package sources and trust material available in your environment.bundle.uds.hcl uds {bundle_api_version = "uds.dev/v1alpha1"}metadata {name = "my-app"description = "My application bundle"version = "1.0.0"}package "database" {source = "oci://ghcr.io/my-org/packages/postgres:15.0.0"signature_verification {public_key = file("keys/my-org.pub")}}package "api" {source = "oci://ghcr.io/my-org/packages/my-api:2.0.0"depends_on = [package.database]values_files = ["values/api.yaml"]signature_verification {keyless {certificate_identity = "https://github.com/my-org/api/.github/workflows/release.yml@refs/heads/main"certificate_oidc_issuer = "https://token.actions.githubusercontent.com"}}}Create the values file referenced by the
apipackage. Values files support Go templates. The{{ .vars.* }}expressions read variables available at deploy time, including values fromdefaults.uds.hclorconfig.uds.hcl; missing variables cause deployment to fail. In this example, the package maps thereplicasvalue to the chart’sreplicaCountvalue:values/api.yaml replicas: {{ .vars.replica_count }}The package author defines that mapping in the package’s
zarf.yaml:zarf.yaml kind: ZarfPackageConfigmetadata:name: apiversion: 1.0.0values:files:- values.yamlcomponents:- name: apirequired: truecharts:- name: apiversion: 1.0.0namespace: apiurl: oci://ghcr.io/my-org/charts/apivalues:- sourcePath: ".replicas"targetPath: ".replicaCount"sourcePathidentifies the key in the Zarf values file, andtargetPathidentifies the corresponding Helm chart value. At deploy time, thereplica_countbundle variable becomes the Zarfreplicasvalue, which Zarf maps to the chart’sreplicaCountvalue.The package ID is the label after
package. Use it withdepends_onto control deployment order, for exampledepends_on = [package.database]. Independent packages deploy in parallel.Each package needs one verification method:
public_key,keyless, or an explicitsignature_verification { verify = false }bypass. Use the bypass only for local alpha workflows. It produces a warning. -
Use defaults and locals
Put environment-independent defaults in
defaults.uds.hclnext to the bundle definition:defaults.uds.hcl variables = {cluster_name = "development"replica_count = 1}Use
localsto avoid repeating registry or version values:bundle.uds.hcl locals {package_registry = "ghcr.io/my-org/packages"api_version = "2.0.0"}package "api" {source = "oci://${local.package_registry}/my-api:${local.api_version}"signature_verification { verify = false }}Use
file(path)for UTF-8 text files. Paths resolve relative to the HCL file. -
Create the artifact
Create a signed artifact using a local Cosign key:
Terminal window CLI_FEATURES=NextMode=true uds bundle create . --signing-key ./cosign.keyFor a local unsigned test artifact:
Terminal window CLI_FEATURES=NextMode=true uds bundle create . --unsignedUse
--keylessto sign through an OIDC identity. The command writes a local.tar.zstcontaining the definition, defaults, values, and package content.
Verification
Section titled “Verification”Confirm that the artifact exists and contains the bundle metadata:
CLI_FEATURES=NextMode=true uds bundle inspect ./uds-bundle-my-app-<ARCH>-1.0.0.tar.zstReplace <ARCH> with the target architecture, such as amd64 or arm64.
Related documentation
Section titled “Related documentation”- Deploy a bundle in Next mode - Deploy a definition or created artifact.
- Next mode reference - Review the complete HCL and command reference.