From ac35c9c6014c376d3235636a2d93b48e09a5ff2f Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Wed, 12 Jun 2024 18:12:36 +0000 Subject: [PATCH] Add handling of amd64 canonical ubuntu lts images on compute disk. (#10952) [upstream:716507e1ae25949b6d9835a07c9b69ecf88fbae2] Signed-off-by: Modular Magician --- .changelog/10952.txt | 3 ++ google/services/compute/image.go | 2 +- .../compute/resource_compute_disk_test.go | 30 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .changelog/10952.txt diff --git a/.changelog/10952.txt b/.changelog/10952.txt new file mode 100644 index 00000000000..e0a014bd2bf --- /dev/null +++ b/.changelog/10952.txt @@ -0,0 +1,3 @@ +```release-note:bug +compute: fixed perma-diff on `google_compute_disk` for Ubuntu amd64 canonical LTS images +``` \ No newline at end of file diff --git a/google/services/compute/image.go b/google/services/compute/image.go index df985b333a6..0da0d39f419 100644 --- a/google/services/compute/image.go +++ b/google/services/compute/image.go @@ -32,7 +32,7 @@ var ( resolveImageLink = regexp.MustCompile(fmt.Sprintf("^https://www.googleapis.com/compute/[a-z0-9]+/projects/(%s)/global/images/(%s)", verify.ProjectRegex, resolveImageImageRegex)) windowsSqlImage = regexp.MustCompile("^sql-(?:server-)?([0-9]{4})-([a-z]+)-windows-(?:server-)?([0-9]{4})(?:-r([0-9]+))?-dc-v[0-9]+$") - canonicalUbuntuLtsImage = regexp.MustCompile("^ubuntu-(minimal-)?([0-9]+)(?:.*(arm64))?.*$") + canonicalUbuntuLtsImage = regexp.MustCompile("^ubuntu-(minimal-)?([0-9]+)(?:.*(arm64|amd64))?.*$") cosLtsImage = regexp.MustCompile("^cos-([0-9]+)-") ) diff --git a/google/services/compute/resource_compute_disk_test.go b/google/services/compute/resource_compute_disk_test.go index 9e6d3f6073f..1b3a7b028cb 100644 --- a/google/services/compute/resource_compute_disk_test.go +++ b/google/services/compute/resource_compute_disk_test.go @@ -265,6 +265,16 @@ func TestDiskImageDiffSuppress(t *testing.T) { New: "ubuntu-minimal-2210-amd64", ExpectDiffSuppress: true, }, + "matching image ubuntu amd64 canonical lts self_link": { + Old: "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2404-noble-amd64-v20240423", + New: "ubuntu-2404-lts-amd64", + ExpectDiffSuppress: true, + }, + "matching image ubuntu minimal amd64 canonical lts self_link": { + Old: "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-minimal-2404-noble-amd64-v20240423", + New: "ubuntu-minimal-2404-lts-amd64", + ExpectDiffSuppress: true, + }, "different architecture image ubuntu amd64 self_link": { Old: "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2210-kinetic-amd64-v20221022", New: "ubuntu-2210", @@ -285,6 +295,26 @@ func TestDiskImageDiffSuppress(t *testing.T) { New: "ubuntu-minimal-2210-amd64", ExpectDiffSuppress: false, }, + "different image ubuntu amd64 canonical lts self_link": { + Old: "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2404-noble-amd64-v20240423", + New: "ubuntu-2404-lts", + ExpectDiffSuppress: false, + }, + "different image ubuntu minimal amd64 canonical lts self_link": { + Old: "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-minimal-2404-noble-amd64-v20240423", + New: "ubuntu-minimal-2404-lts", + ExpectDiffSuppress: false, + }, + "different image ubuntu amd64 canonical lts family": { + Old: "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-2404-noble-v20240423", + New: "ubuntu-2404-lts-amd64", + ExpectDiffSuppress: false, + }, + "different image ubuntu minimal amd64 canonical lts family": { + Old: "https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/images/ubuntu-minimal-2404-noble-v20240423", + New: "ubuntu-minimal-2404-lts-amd64", + ExpectDiffSuppress: false, + }, } for tn, tc := range cases {