From e34aea50650540e14b40f38fc37e83e64534011e Mon Sep 17 00:00:00 2001 From: Michael Nguyen Date: Thu, 18 May 2023 15:42:47 -0400 Subject: [PATCH] kola/test: update rhcos upgrade test to new s3 dir Originally RHCOS only had one stream named after the OCP major minor version. Around the 4.12 timeframe, the ability to produce concurrent RHCOS versions based on different RHEL content was introduced. This changed the stream name used in the mirror where this test downloads the latest released RHCOS version. Since the stream name is not in the build metadata, the RHEL version portion of the stream name can only be inferred from the RHCOS version string. This may be cause issues when there is a three digit RHEL version. --- mantle/kola/tests/rhcos/upgrade.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mantle/kola/tests/rhcos/upgrade.go b/mantle/kola/tests/rhcos/upgrade.go index 382917118b..e2eda9dee0 100644 --- a/mantle/kola/tests/rhcos/upgrade.go +++ b/mantle/kola/tests/rhcos/upgrade.go @@ -287,7 +287,12 @@ func getJson(url string, target interface{}) error { func downloadLatestReleasedRHCOS(target string) (string, error) { buildID := kola.CosaBuild.Meta.BuildID ocpVersion := strings.Split(buildID, ".")[0] + rhelVersion := strings.Split(buildID, ".")[1] ocpVersionF := fmt.Sprintf("%s.%s", ocpVersion[:1], ocpVersion[1:]) + // The stream name isn't anywhere in the build so we can only infer + // the RHEL version from the RHCOS version string. This will break + // on three digit versions like 10.1 or 9.10. + rhelVersionF := fmt.Sprintf("%s.%s", rhelVersion[:1], rhelVersion[1:]) channel := "fast-" + ocpVersionF type Release struct { @@ -395,16 +400,17 @@ func downloadLatestReleasedRHCOS(target string) (string, error) { var latestOcpRhcosBuild *cosa.Build rhcosVersion := ocpRelease.DisplayVersions.MachineOS.Version - latestBaseUrl := fmt.Sprintf("https://rhcos.mirror.openshift.com/art/storage/prod/streams/%s/builds/%s/%s", + latestBaseUrl := fmt.Sprintf("https://rhcos.mirror.openshift.com/art/storage/prod/streams/%s-%s/builds/%s/%s", ocpVersionF, + rhelVersionF, rhcosVersion, coreosarch.CurrentRpmArch()) latestRhcosBuildMetaUrl := fmt.Sprintf("%s/meta.json", latestBaseUrl) if err := getJson(latestRhcosBuildMetaUrl, &latestOcpRhcosBuild); err != nil { - // Try the old bucket layout; ideally we'd only do this if the error + // Try the stream; ideally we'd only do this if the error // was 403 denied (which is really a 404), but meh this is temporary // anyway. - latestBaseUrl = fmt.Sprintf("https://rhcos.mirror.openshift.com/art/storage/releases/rhcos-%s/%s/%s", + latestBaseUrl = fmt.Sprintf("https://rhcos.mirror.openshift.com/art/storage/prod/streams/%s/builds/%s/%s", ocpVersionF, rhcosVersion, coreosarch.CurrentRpmArch())