Skip to content

Commit c8a073a

Browse files
CR-8437 rollback installation in case of failure (#201)
* appending logs to summary * change to global array * clear array after print * fixed duplicate code * improve string * postInstallationHandler * bump * move defer to later installation stage * small improvement * removed cli upgrade requirment * removed unused import * removed reportInstallationErrorToPlatform * no rollback in case of timeout of failure in creating git integration * cli upgrade requirement in case of a newer defVersion * add link to docs with error message * add info log * small change * small change * added runtime name to error msg * bump * moved defVersion check to pre-installation checks * added error decorator for docs link * modified error decorator * typo fix * var name fix * bump * bump * handle RunRuntimeUninstall error * small fix
1 parent 989c0ac commit c8a073a

File tree

11 files changed

+144
-133
lines changed

11 files changed

+144
-133
lines changed

Makefile

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

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

cmd/commands/common.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import (
3636
"regexp"
3737
"strings"
3838

39-
"github.com/Masterminds/semver/v3"
4039
"github.com/argoproj-labs/argocd-autopilot/pkg/git"
4140
"github.com/codefresh-io/cli-v2/pkg/config"
4241
"github.com/codefresh-io/cli-v2/pkg/log"
@@ -60,6 +59,7 @@ var (
6059
cfConfig *config.Config
6160

6261
GREEN = "\033[32m"
62+
RED = "\033[31m"
6363
CYAN = "\033[36m"
6464
BOLD = "\033[1m"
6565
UNDERLINE = "\033[4m"
@@ -360,19 +360,3 @@ func getIngressHostFromUserInput(cmd *cobra.Command, ingressHost *string) error
360360

361361
return nil
362362
}
363-
364-
func verifyCLILatestVersion(ctx context.Context) error {
365-
latestVersionString, err := cfConfig.NewClient().V2().CliReleases().GetLatest(ctx)
366-
if err != nil {
367-
return fmt.Errorf("failed getting latest cli release: %w", err)
368-
}
369-
370-
latestVersionSemver := semver.MustParse(latestVersionString)
371-
currentVersion := store.Get().Version.Version
372-
373-
if currentVersion.LessThan(latestVersionSemver) {
374-
return fmt.Errorf("please upgrade to the latest cli version: %s", latestVersionString)
375-
}
376-
377-
return nil
378-
}

cmd/commands/component.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ func NewComponentListCommand() *cobra.Command {
7373
RunE: func(cmd *cobra.Command, args []string) error {
7474
ctx := cmd.Context()
7575

76-
if err := verifyCLILatestVersion(ctx); err != nil {
77-
return err
78-
}
79-
8076
return RunComponentList(ctx, args[0])
8177
},
8278
}

cmd/commands/git-source.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,6 @@ func NewGitSourceCreateCommand() *cobra.Command {
180180
RunE: func(cmd *cobra.Command, args []string) error {
181181
ctx := cmd.Context()
182182

183-
if err := verifyCLILatestVersion(ctx); err != nil {
184-
return err
185-
}
186-
187183
return RunGitSourceCreate(ctx, &GitSourceCreateOptions{
188184
InsCloneOpts: insCloneOpts,
189185
GsCloneOpts: gsCloneOpts,
@@ -402,10 +398,6 @@ func NewGitSourceListCommand() *cobra.Command {
402398
RunE: func(cmd *cobra.Command, args []string) error {
403399
ctx := cmd.Context()
404400

405-
if err := verifyCLILatestVersion(ctx); err != nil {
406-
return err
407-
}
408-
409401
return RunGitSourceList(ctx, args[0])
410402
},
411403
}
@@ -503,10 +495,6 @@ func NewGitSourceDeleteCommand() *cobra.Command {
503495
RunE: func(cmd *cobra.Command, args []string) error {
504496
ctx := cmd.Context()
505497

506-
if err := verifyCLILatestVersion(ctx); err != nil {
507-
return err
508-
}
509-
510498
return RunGitSourceDelete(ctx, &GitSourceDeleteOptions{
511499
RuntimeName: args[0],
512500
GsName: args[1],
@@ -578,10 +566,6 @@ func NewGitSourceEditCommand() *cobra.Command {
578566
RunE: func(cmd *cobra.Command, args []string) error {
579567
ctx := cmd.Context()
580568

581-
if err := verifyCLILatestVersion(ctx); err != nil {
582-
return err
583-
}
584-
585569
return RunGitSourceEdit(ctx, &GitSourceEditOptions{
586570
RuntimeName: args[0],
587571
GsName: args[1],

cmd/commands/pipeline.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ func NewPipelineGetCommand() *cobra.Command {
7676
RunE: func(cmd *cobra.Command, args []string) error {
7777
ctx := cmd.Context()
7878

79-
if err := verifyCLILatestVersion(ctx); err != nil {
80-
return err
81-
}
82-
8379
return RunPipelineGet(ctx, name, namespace, runtime)
8480
},
8581
}
@@ -115,10 +111,6 @@ func NewPipelineListCommand() *cobra.Command {
115111
RunE: func(cmd *cobra.Command, args []string) error {
116112
ctx := cmd.Context()
117113

118-
if err := verifyCLILatestVersion(ctx); err != nil {
119-
return err
120-
}
121-
122114
filterArgs := model.PipelinesFilterArgs{
123115
Name: &name,
124116
Namespace: &namespace,

0 commit comments

Comments
 (0)