This example demonstrates using Zarf to import components from existing Zarf package definitions while merging overrides to add or change functionality. It uses the existing DOS games example by simply adding
import keys in the new zarf.yaml file.
import key in Zarf supports two modes to pull in a component:
pathkey allows you to specify a path to a directory that contains the
zarf.yamlthat you wish to import on your local filesystem. This allows you to have a common component that you can reuse across multiple packages within a project (i.e. within one team/codebase).
urlkey allows you to specify an
oci://URL to a skeleton package that was published to an OCI registry. Skeleton packages are special package bundles that contain the
zarf.yamlpackage definition and any local files referenced by that definition at publish time. This allows you to version a set of reusable components and import them into multiple packages across projects (i.e. across teams/codebases).
You can create a skeleton package from a
zarf.yaml by pointing
zarf package publish at the directory that contains it:
zarf package publish path/containing/package/definition oci://your-registry.com
When merging components together Zarf will adopt the following strategies depending on the kind of primitive (
manifests) that it is merging:
|Component Behavior||These keys control how Zarf interacts with a given component and will always take the value of the overriding component|
|Component Description||This key will only take the value of the overriding component if it is not empty|
|Cosign Key Path||[Deprecated] This key will only take the value of the overriding component if it is not empty|
|Un'name'd Primitive Arrays||These keys will append the overriding component's version of the array to the end of the base component's array|
|'name'd Primitive Arrays||For any given element in the overriding component, if the element matches based on |
To view the example in its entirety, select the
Edit this page link below the article and select the parent folder.
As you can see in the example, the
import key can be combined with other keys to merge components together. This can be done as many components deep as you wish and in the end will generate one main
zarf.yaml file with all of the defined resources included.
This is useful if you want to slightly tweak a given component while maintaining a common core.
url must be statically defined at create time. You cannot use package templates within them.