From 33fd47b5b15cbb1a7e828fe98fbe21624b3c2987 Mon Sep 17 00:00:00 2001 From: Pavel Sturc Date: Tue, 27 Feb 2024 11:34:34 +0100 Subject: [PATCH] fix: ocp upgrade: support any channel type --- magefiles/upgrade/upgrade.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/magefiles/upgrade/upgrade.go b/magefiles/upgrade/upgrade.go index 648d489f9..49b9f211f 100644 --- a/magefiles/upgrade/upgrade.go +++ b/magefiles/upgrade/upgrade.go @@ -26,7 +26,7 @@ import ( ) const majorMinorVersionFormat = "4.%d" -const fastChannelFormat = "fast-" + majorMinorVersionFormat +const channelFormat = "%s-" + majorMinorVersionFormat const spiVaultNamespaceName = "spi-vault" const spiVaultPodName = "vault-0" @@ -76,13 +76,15 @@ func newStatusHelper(kcs *kubeclient.Clientset, ccs *configv1client.Clientset) ( currentChannel := clusterVersion.Spec.Channel klog.Infof("current channel is %q, current ocp version is %q", currentChannel, initialVersion) + sp := strings.Split(currentChannel, "-") + channelType, currentChannelVersion := sp[0], sp[1] var minorVersion int - if _, err = fmt.Sscanf(currentChannel, fastChannelFormat, &minorVersion); err != nil { + if _, err = fmt.Sscanf(currentChannelVersion, majorMinorVersionFormat, &minorVersion); err != nil { return nil, fmt.Errorf("can't detect the next version channel: %+v", err) } currentMajorMinorVersion := fmt.Sprintf(majorMinorVersionFormat, minorVersion+1) nextMajorMinorVersion := fmt.Sprintf(majorMinorVersionFormat, minorVersion+1) - nextVersionChannel := fmt.Sprintf(fastChannelFormat, minorVersion+1) + nextVersionChannel := fmt.Sprintf(channelFormat, channelType, minorVersion+1) var foundNextVersionChannel bool for _, ch := range clusterVersion.Status.Desired.Channels {