Developers guide

Prerequisites

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

  1. Build (or download) the vhdx/vhd image files for:

  2. Download the test RPM files:

    ./toolkit/tools/pkg/imagecustomizerlib/testdata/testrpms/download-test-rpms.sh
    
  3. 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>"
    
    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-core-legacy-azl2 "$AZURE_LINUX_2_CORE_LEGACY_VHD"
      --base-image-core-legacy-azl3 "$AZURE_LINUX_3_CORE_LEGACY_VHD"
    
  4. To update go dependencies (direct and indirect) to minor or patch versions, run go get -u ./... then go mod tidy.