Skip to content

Commit

Permalink
Cleaner cli-config version support checking
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Weiße <[email protected]>
  • Loading branch information
daniel-weisse committed Sep 8, 2023
1 parent 0ce695a commit 0bbf39e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cli/internal/helm/actionfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 0bbf39e

Please sign in to comment.