diff --git a/cli/internal/helm/actionfactory.go b/cli/internal/helm/actionfactory.go index 106f9c8b0f..92ae21968f 100644 --- a/cli/internal/helm/actionfactory.go +++ b/cli/internal/helm/actionfactory.go @@ -74,10 +74,12 @@ func (a actionFactory) appendNewAction(release Release, configTargetVersion semv if err != nil { return fmt.Errorf("parsing chart version: %w", err) } + cliSupportsConfigVersion := configTargetVersion.Compare(newVersion) != 0 + currentVersion, err := a.versionLister.currentVersion(release.ReleaseName) if errors.Is(err, errReleaseNotFound) { // Don't install a new release if the user's config specifies a different version than the CLI offers. - if !force && isCLIVersionedRelease(release.ReleaseName) && configTargetVersion.Compare(newVersion) != 0 { + if !force && isCLIVersionedRelease(release.ReleaseName) && cliSupportsConfigVersion { return fmt.Errorf( "unable to install release %s at %s: this CLI only supports microservice version %s for upgrading", release.ReleaseName, configTargetVersion, newVersion, @@ -104,7 +106,7 @@ func (a actionFactory) appendNewAction(release Release, configTargetVersion semv } // Target version is newer than current version, so we should perform an upgrade. // Now make sure the target version is equal to the the CLI version. - if configTargetVersion.Compare(newVersion) != 0 { + if cliSupportsConfigVersion { return fmt.Errorf( "unable to upgrade release %s to %s: this CLI only supports microservice version %s for upgrading", release.ReleaseName, configTargetVersion, newVersion,