imageconfigvalidator) checks Azure Linux image configuration files for correctness and common errors before starting a build.
Overview
The validator performs sanity checks on image configuration files to catch errors early:- Validates configuration structure and syntax
- Checks package list consistency
- Verifies kernel and boot requirements
- Validates partitioning for kickstart installations
- Ensures required packages are present
Usage
Parameters
Required Parameters
Path to the image configuration file to validate (typically a
.json or .yaml file).Base directory for resolving relative file paths referenced in the configuration.
Optional Parameters
File to store timing information for performance analysis.
Logging and Profiling
Path to file for log output.
Log level: panic, fatal, error, warn, info, debug, trace.
Path to save CPU profiling data.
Path to save memory profiling data.
Examples
Basic Validation
Validate an image configuration file:Validate with Logging
Enable detailed logging during validation:Validate with Timing
Capture timing information:Validation Checks
The validator performs the following checks:1. Configuration Structure
Verifies the configuration file is well-formed and contains required fields.2. Package Validation
Checks that package lists are consistent and complete:Kernel Package
FIPS Requirements
If FIPS mode is enabled (viafips=1 kernel parameter or EnableFIPS), the validator ensures:
- The
dracut-fipspackage is included in the package list
SELinux Requirements
If SELinux is enabled (not set tooff), the validator checks:
- The SELinux policy package is included (default:
selinux-policy-targeted)
User/Group Requirements
If users or groups are configured in the image, the validator ensures:- The
shadow-utilspackage is included (providesuseradd,groupadd, etc.)
3. Kickstart Installation Validation
For kickstart-based installations:4. File Path Resolution
Validates that all file paths referenced in the configuration exist and are accessible relative to the base directory.Exit Codes
The validator uses the following exit codes:- 0 - Configuration is valid
- 1 - Configuration is invalid or validation failed
Common Validation Errors
Kernel in Package List
Error:kernel from package lists and specify it in kernelOptions.
Missing dracut-fips
Error:dracut-fips to your package list when enabling FIPS.
Missing SELinux Policy
Error:Missing shadow-utils
Error:shadow-utils to your package list if you’re creating users or groups.
Kickstart with Partitions
Error:disks and partitionSettings from your configuration when using kickstart.
Integration with Build Process
The validator should be run before starting an image build:Best Practices
- Validate early: Run the validator before starting expensive build operations
- Use absolute paths: Provide absolute paths or use
--base-dirconsistently - Check dependencies: Ensure all required packages are in package lists
- Version control: Keep validated configurations in version control
- CI/CD integration: Add validation as a pre-build step in your pipeline
Configuration File Structure
For details on image configuration file format, see:Related Tools
- Image Generator - Build images from validated configurations
- Image Customizer - Customize existing images
- License Check - Validate RPM license files
- Spec Reader - Parse RPM spec files