Developers guide
Prerequisites
- Golang
- Trivy for license scanning
For other package dependencies, see Getting started guide
Build Image Customizer binary
Run:
sudo make -C ./toolkit go-imagecustomizer
If you’re updating the image customizer API as part of your change, you need to
update the API schema.json before sending a PR. To do so, run:
make -C toolkit/tools/imagecustomizerschemacli/
Run toolkit tests
Run:
sudo go test -C ./toolkit/tools ./...
Run Image Customizer specific tests
-
Build (or download) the vhdx/vhd image files for:
- Azure Linux 2.0 core-efi
- Azure Linux 3.0 core-efi
- Azure Linux 2.0 core-legacy
- Azure Linux 3.0 core-legacy
- Ubuntu 22.04 Azure cloud (download the
*-azure.vhd.tar.gzand extract) - Ubuntu 24.04 Azure cloud (download the
*-azure.vhd.tar.gzand extract)
-
Download the test RPM files:
./toolkit/tools/internal/testutils/testrpms/download-test-utils.sh -d azurelinux -t 3.0 -s true -
Run the tests:
AZURE_LINUX_2_CORE_EFI_VHDX="<core-efi-2.0.vhdx>" AZURE_LINUX_3_CORE_EFI_VHDX="<core-efi-3.0.vhdx>" AZURE_LINUX_2_CORE_LEGACY_VHD="<core-legacy-2.0.vhd>" AZURE_LINUX_3_CORE_LEGACY_VHD="<core-legacy-3.0.vhd>" UBUNTU_2204_AZURE_CLOUD_VHD="<ubuntu-22.04-azure-cloud.vhd>" UBUNTU_2404_AZURE_CLOUD_VHD="<ubuntu-24.04-azure-cloud.vhd>" sudo go test -C ./toolkit/tools ./pkg/imagecustomizerlib -args \ --base-image-core-efi-azl2 "$AZURE_LINUX_2_CORE_EFI_VHDX" \ --base-image-core-efi-azl3 "$AZURE_LINUX_3_CORE_EFI_VHDX" \ --base-image-bare-metal-azl2 "$AZURE_LINUX_2_CORE_LEGACY_VHD" \ --base-image-bare-metal-azl3 "$AZURE_LINUX_3_CORE_LEGACY_VHD" \ --base-image-azure-cloud-ubuntu2204 "$UBUNTU_2204_AZURE_CLOUD_VHD" \ --base-image-azure-cloud-ubuntu2404 "$UBUNTU_2404_AZURE_CLOUD_VHD" -
To update go dependencies (direct and indirect) to minor or patch versions, run
go get -u ./...thengo mod tidy.