Skip to content

Commit 43e5aec

Browse files
committed
E2E: Use bucket for flatcar production image
There seems to be an issue with downloading the image straight from upstream. This adds GlanceName to the DownloadImage struct to allow overriding the inferred Glance image name, since the bucket filename includes a version number but we want the Glance image to keep the original name. Signed-off-by: Lennart Jern <lennart.jern@est.tech>
1 parent 6825911 commit 43e5aec

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

test/e2e/shared/images.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ type DownloadImage struct {
6060
ArtifactPath string
6161
// A hash used to verify the downloaded image
6262
Hash, HashAlgorithm string
63+
// GlanceName overrides the inferred Glance image name if set
64+
GlanceName string
6365
}
6466

6567
func CoreImages(e2eCtx *E2EContext) []DownloadImage {
@@ -128,13 +130,16 @@ func ApplyGlanceImages(ctx context.Context, e2eCtx *E2EContext, images []Downloa
128130
Expect(err).NotTo(HaveOccurred(), "parsing "+url)
129131
d := strings.Split(u.Path, "/")
130132
Expect(len(d)).To(BeNumerically(">", 1), "Not enough path elements in "+url)
131-
glanceName := d[len(d)-1]
132-
133-
// Remove the type suffix
134-
for _, suffix := range []string{".img", ".qcow2"} {
135-
if strings.HasSuffix(glanceName, suffix) {
136-
glanceName = glanceName[:len(glanceName)-len(suffix)]
137-
continue
133+
glanceName := image.GlanceName
134+
if glanceName == "" {
135+
glanceName = d[len(d)-1]
136+
137+
// Remove the type suffix
138+
for _, suffix := range []string{".img", ".qcow2"} {
139+
if strings.HasSuffix(glanceName, suffix) {
140+
glanceName = glanceName[:len(glanceName)-len(suffix)]
141+
continue
142+
}
138143
}
139144
}
140145

test/e2e/suites/e2e/e2e_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ func flatcarImages(e2eCtx *shared.E2EContext) []shared.DownloadImage {
7171
ArtifactPath: "flatcar/" + e2eCtx.E2EConfig.GetVariable("OPENSTACK_FLATCAR_IMAGE_NAME") + ".img",
7272
},
7373
{
74-
Name: "flatcar-openstack",
75-
URL: "https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_openstack_image.img",
74+
Name: "flatcar-openstack",
75+
URL: "https://storage.googleapis.com/artifacts.k8s-staging-capi-openstack.appspot.com/test/flatcar/flatcar_production_openstack_image-4459.2.2.img",
76+
GlanceName: "flatcar_production_openstack_image",
7677
},
7778
}
7879
}

0 commit comments

Comments
 (0)