Skip to content

Commit

Permalink
kola/test: update rhcos upgrade test to new s3 dir
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mike-nguyen authored and jlebon committed May 19, 2023
1 parent 7283c89 commit e34aea5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions mantle/kola/tests/rhcos/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 <ocp version> 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())
Expand Down

0 comments on commit e34aea5

Please sign in to comment.