Skip to content

Developing Packages

Zarf uses the Zarf package schema to define its configuration files. This schema is used to describe package configuration options and enable the validation of configuration files prior to their use in building a Zarf Package.

The zarf dev lint command is used to validate a zarf.yaml file against the Zarf schema. This command is useful for ensuring that a zarf.yaml file is correctly formatted and adheres to the Zarf schema.

Terminal window
zarf dev lint <dir>

  1. Open VS Code.
  2. Install the YAML extension by RedHat.
  3. Open the VS Code command palette by typing CTRL/CMD + SHIFT + P.
  4. Type Preferences: Open User Settings (JSON)into the search bar to open the settings.json file.
  5. Add the below code to the settings.json config, or modify the existing yaml.schemas object to include the Zarf schema.
"yaml.schemas": {
"https://raw.githubusercontent.com/defenseunicorns/zarf/main/zarf.schema.json": "zarf.yaml"
}

To ensure consistent validation of the Zarf schema version in a zarf.yaml file, it can be beneficial to lock it to a specific version. This can be achieved by appending the following statement to the first line of any given zarf.yaml file:

# yaml-language-server: $schema=https://raw.githubusercontent.com/defenseunicorns/zarf/<VERSION>/zarf.schema.json

In the above example, <VERSION> should be replaced with the specific Zarf release.

yaml schema

The dev deploy command combines the lifecycle of package create and package deploy into a single command. This command will:

  • Not result in a re-usable tarball / OCI artifact
  • Not have any interactive prompts
  • Not require zarf init to be run (by default, but is required if --no-yolo is not set)
  • Be able to create+deploy a package in either YOLO mode (default) or prod mode (exposed via --no-yolo flag)
  • Only build + deploy components that will be deployed (contrasting with package create which builds all components regardless of whether they will be deployed)
Terminal window
# Create and deploy dos-games in yolo mode
$ zarf dev deploy examples/dos-games
Terminal window
# If deploying a package in prod mode, `zarf init` must be run first
$ zarf init --confirm
# Create and deploy dos-games in prod mode
$ zarf dev deploy examples/dos-games --no-yolo

Evaluates components in a zarf.yaml to identify images specified in their helm charts and manifests.

Components that have git repositories that host helm charts can be processed by providing the --repo-chart-path.

Terminal window
$ zarf dev find-images examples/wordpress
components:
- name: wordpress
images:
- docker.io/bitnami/apache-exporter:0.13.3-debian-11-r2
- docker.io/bitnami/mariadb:10.11.2-debian-11-r21
- docker.io/bitnami/wordpress:6.2.0-debian-11-r18