diff --git a/e2e/cmd/build_base_image/00_check_vm_image/main.go b/e2e/cmd/build_base_image/00_check_vm_image/main.go index e563e41d8..f44b983e8 100644 --- a/e2e/cmd/build_base_image/00_check_vm_image/main.go +++ b/e2e/cmd/build_base_image/00_check_vm_image/main.go @@ -109,7 +109,7 @@ func action(ctx context.Context, _ *command.Command) error { // - Z: patch version, incremented for consecutive builds of the same minor version, starts at 0 // Handle case where we have no custom image at all - if latestCustomImageVersion == "0.0.0" || force { + if latestCustomImageVersion == az.NullImageVersion || force { fmt.Println(latest.URN) return nil } diff --git a/e2e/cmd/build_base_image/02_create_vm_template/main.go b/e2e/cmd/build_base_image/02_create_vm_template/main.go index 03d0e9a5f..cbe343b52 100644 --- a/e2e/cmd/build_base_image/02_create_vm_template/main.go +++ b/e2e/cmd/build_base_image/02_create_vm_template/main.go @@ -82,7 +82,7 @@ func action(ctx context.Context, cmd *command.Command) error { }() // If the version is empty, we need to create the image definition - if latestImageVersion == "0.0.0" { + if latestImageVersion == az.NullImageVersion { log.Infof("Creating image definition %q", imageDefinition) _, _, err := az.RunCommand(ctx, "sig", "image-definition", "create", "--resource-group", "AD", diff --git a/e2e/internal/az/image.go b/e2e/internal/az/image.go index c798c5b26..ba6f19337 100644 --- a/e2e/internal/az/image.go +++ b/e2e/internal/az/image.go @@ -11,6 +11,9 @@ import ( "golang.org/x/exp/slices" ) +// NullImageVersion is the version returned when no image version is found. +const NullImageVersion = "0.0.0" + // Image contains information about an Azure image. type Image struct { Architecture string `json:"architecture"` @@ -104,7 +107,7 @@ func (i Image) isGen2Image() bool { // LatestImageVersion returns the latest image version for the given image definition. // If no version exists, "0.0.0" is returned. func LatestImageVersion(ctx context.Context, imageDefinition string) (string, error) { - latestVersion := "0.0.0" + latestVersion := NullImageVersion out, _, err := RunCommand(ctx, "sig", "image-version", "list", "--resource-group", "AD",