Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add handling of amd64 canonical ubuntu lts images on compute disk. #18418

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/10952.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
compute: fixed perma-diff on `google_compute_disk` for Ubuntu amd64 canonical LTS images
```
2 changes: 1 addition & 1 deletion google/services/compute/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]+)-")
)

Expand Down
30 changes: 30 additions & 0 deletions google/services/compute/resource_compute_disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 {
Expand Down