Skip to content

Commit 6c38c14

Browse files
authored
Fix image diff suppress failures (#15761)
1 parent 5e6a774 commit 6c38c14

File tree

2 files changed

+30
-0
lines changed
  • mmv1

2 files changed

+30
-0
lines changed

mmv1/templates/terraform/constants/disk.tmpl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,14 @@ func diskImageFamilyEquals(imageName, familyName string) bool {
187187
return true
188188
}
189189

190+
if suppressFedoraFamilyDiff(imageName, familyName) {
191+
return true
192+
}
193+
194+
if suppressSuseFamilyDiff(imageName, familyName) {
195+
return true
196+
}
197+
190198
if suppressCosFamilyDiff(imageName, familyName) {
191199
return true
192200
}
@@ -220,6 +228,26 @@ func suppressCanonicalFamilyDiff(imageName, familyName string) bool {
220228
return false
221229
}
222230

231+
func suppressFedoraFamilyDiff(imageName, familyName string) bool {
232+
parts := fedoraImage.FindStringSubmatch(imageName)
233+
if len(parts) == 6 {
234+
if strings.HasPrefix(familyName, "fedora-") {
235+
return true
236+
}
237+
}
238+
return false
239+
}
240+
241+
func suppressSuseFamilyDiff(imageName, familyName string) bool {
242+
parts := suseImage.FindStringSubmatch(imageName)
243+
if len(parts) == 4 {
244+
if strings.HasPrefix(familyName, "sles-") {
245+
return true
246+
}
247+
}
248+
return false
249+
}
250+
223251
// e.g. image: cos-NN-*, family: cos-NN-lts
224252
func suppressCosFamilyDiff(imageName, familyName string) bool {
225253
parts := cosLtsImage.FindStringSubmatch(imageName)

mmv1/third_party/terraform/services/compute/image.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ var (
3333

3434
windowsSqlImage = regexp.MustCompile("^sql-(?:server-)?([0-9]{4})-([a-z]+)-windows-(?:server-)?([0-9]{4})(?:-r([0-9]+))?-dc-v[0-9]+$")
3535
canonicalUbuntuLtsImage = regexp.MustCompile("^ubuntu-(minimal-)?([0-9]+)(?:.*(arm64|amd64))?.*$")
36+
fedoraImage = regexp.MustCompile("^fedora-coreos-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-gcp-(x86-64|aarch64)$")
37+
suseImage = regexp.MustCompile("^sles-([0-9]+)-([0-9]+)-(v[0-9]+)-x86-64$")
3638
cosLtsImage = regexp.MustCompile("^cos-([0-9]+)-")
3739
)
3840

0 commit comments

Comments
 (0)