Skip to content

Commit a983bd4

Browse files
Adjust CLI to block uninstall and upgrade for helm runtime (#687)
* Adjust CLI to block uninstall and upgrade for helm runtime * bump * fix
1 parent bf42a1b commit a983bd4

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.1.41
1+
VERSION=v0.1.42
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

cmd/commands/common.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,15 @@ func isRuntimeManaged(ctx context.Context, runtimeName string) (bool, error) {
767767
return rt.Managed, nil
768768
}
769769

770+
func getRuntimeInstallationType(ctx context.Context, runtimeName string) (*platmodel.InstallationType, error) {
771+
rt, err := getRuntime(ctx, runtimeName)
772+
if err != nil {
773+
return nil, err
774+
}
775+
776+
return &rt.InstallationType, nil
777+
}
778+
770779
func ensureRuntimeOnKubeContext(ctx context.Context, kubeconfig string, runtimeName string, kubeContextName string) error {
771780
rt, err := getRuntime(ctx, runtimeName)
772781
if err != nil {

cmd/commands/runtime.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,15 @@ func runtimeUninstallCommandPreRunHandler(cmd *cobra.Command, args []string, opt
148148
return err
149149
}
150150

151+
installationType, err := getRuntimeInstallationType(ctx, opts.RuntimeName)
152+
if err != nil {
153+
return err
154+
}
155+
156+
if *installationType == platmodel.InstallationTypeHelm {
157+
return errors.New("This runtime was installed using Helm, please use Helm to uninstall it as well.")
158+
}
159+
151160
if !opts.SkipChecks {
152161
opts.Managed, err = isRuntimeManaged(ctx, opts.RuntimeName)
153162
if err != nil {
@@ -218,6 +227,10 @@ func runtimeUpgradeCommandPreRunHandler(cmd *cobra.Command, args []string, opts
218227
return err
219228
}
220229

230+
if rt.InstallationType == platmodel.InstallationTypeHelm {
231+
return errors.New("This runtime was installed using Helm, please use Helm to upgrade it as well.")
232+
}
233+
221234
opts.RuntimeNamespace = *rt.Metadata.Namespace
222235

223236
if rt.Managed {

docs/releases/release_notes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cf version
2323

2424
```bash
2525
# download and extract the binary
26-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.41/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.42/cf-linux-amd64.tar.gz | tar zx
2727

2828
# move the binary to your $PATH
2929
mv ./cf-linux-amd64 /usr/local/bin/cf
@@ -36,7 +36,7 @@ cf version
3636

3737
```bash
3838
# download and extract the binary
39-
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.41/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.42/cf-darwin-amd64.tar.gz | tar zx
4040

4141
# move the binary to your $PATH
4242
mv ./cf-darwin-amd64 /usr/local/bin/cf

0 commit comments

Comments
 (0)