validate-config subcommand
This subcommand validates configuration files for the customize subcommand without running the actual customization process. For that reason, it does not require root permissions and can be executed by non-privileged users.
Added in v1.2.
--config-file=FILE-PATH
Required.
The file path of the YAML (or JSON) configuration file that specifies how an image should be customized.
For documentation on the supported configuration options, see: Image Customizer configuration
Added in v1.2.
--build-dir=DIRECTORY-PATH
Optional. Required when --validate-resources includes oci or all.
The directory where the tool will place its temporary files, if required.
Added in v1.2.
--validate-resources=RESOURCE[,RESOURCE...]
Optional.
Can be specified multiple times or as a comma-separated list.
Specifies which resources referenced in the configuration should be validated for existence. Without this flag, only the configuration syntax and structure are validated.
Supported options:
files: Validates that local files and directories exist:iso.additionalFiles[].source: Must point to existing files.os.additionalDirs[].source: Must point to existing directories.os.additionalFiles[].source: Must point to existing files.os.users[].password.value: Must point to an existing file when.typeisplain-text-fileorhashed-file.os.users[].sshPublicKeyPaths[]: Must point to existing files.pxe.additionalFiles[].source: Must point to existing files.scripts.finalizeCustomization[].path: Must point to existing files.scripts.postCustomization[].path: Must point to existing files.
oci: Validates that OCI artifacts exist:input.image.azureLinux: OCI artifact must exist in Microsoft Artifact Registry with a valid notary signature.input.image.oci.uri: OCI artifact must exist.
-
all: Validates all supported resource types. Currently equivalent tofiles,oci.The meaning of
allmay expand in future versions as new resource types are added. Useallwhen you want comprehensive validation of all supported resources, or specify individual resource types explicitly for more predictable behavior across versions.
Added in v1.2.
Examples
Validate configuration syntax only:
imagecustomizer validate-config --config-file=./config.yaml
Validate configuration syntax and local files:
imagecustomizer validate-config --config-file=./config.yaml --validate-resources=files
Validate configuration syntax, local files, and OCI artifacts using a comma-separated list:
imagecustomizer validate-config --build-dir=./build --config-file=./config.yaml --validate-resources=files,oci
Validate configuration syntax, local files, and OCI artifacts by specifying the option multiple times:
imagecustomizer validate-config --build-dir=./build --config-file=./config.yaml --validate-resources=files \
--validate-resources=oci
Validate everything:
imagecustomizer validate-config --build-dir=./build --config-file=./config.yaml --validate-resources=all