Skip to content

Commit 089e837

Browse files
CR-9722 (#284)
* bump * bump and initial commit * bump * tested * handle force flag * log fix * bumping app-proxy * removed redundant * trigger e2e Co-authored-by: roi-codefresh <roi.kramer@codefresh.io>
1 parent 3a0077c commit 089e837

File tree

6 files changed

+44
-9
lines changed

6 files changed

+44
-9
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.259
1+
VERSION=v0.0.260
22

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

cmd/commands/runtime.go

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@ func createGitSources(ctx context.Context, opts *RuntimeInstallOptions) error {
743743
mpCloneOpts.Parse()
744744

745745
createGitSrcMessgae := fmt.Sprintf("Creating %s", store.Get().MarketplaceGitSourceName)
746+
746747
err = RunGitSourceCreate(ctx, &GitSourceCreateOptions{
747748
InsCloneOpts: opts.InsCloneOpts,
748749
GsCloneOpts: mpCloneOpts,
@@ -781,6 +782,28 @@ func createGitIntegration(ctx context.Context, opts *RuntimeInstallOptions) erro
781782
return nil
782783
}
783784

785+
func removeGitIntegrations(ctx context.Context, opts *RuntimeUninstallOptions) error {
786+
appProxyClient, err := cfConfig.NewClient().AppProxy(ctx, opts.RuntimeName, store.Get().InsecureIngressHost)
787+
if err != nil {
788+
return fmt.Errorf("failed to build app-proxy client: %w", err)
789+
}
790+
791+
integrations, err := appProxyClient.GitIntegrations().List(ctx)
792+
if err != nil {
793+
return fmt.Errorf("failed to get list of git integrations: %w", err)
794+
}
795+
796+
for _, intg := range integrations {
797+
if err = RunGitIntegrationRemoveCommand(ctx, appProxyClient, intg.Name); err != nil {
798+
command := util.Doc(fmt.Sprintf("\t<BIN> integration git remove %s", intg.Name))
799+
800+
return fmt.Errorf(`%w. You can try to remove it manually by running: %s`, err, command)
801+
}
802+
}
803+
804+
return nil
805+
}
806+
784807
func addDefaultGitIntegration(ctx context.Context, appProxyClient codefresh.AppProxyAPI, runtime string, opts *apmodel.AddGitIntegrationArgs) error {
785808
if err := RunGitIntegrationAddCommand(ctx, appProxyClient, opts); err != nil {
786809
command := util.Doc(fmt.Sprintf(
@@ -1306,6 +1329,16 @@ func RunRuntimeUninstall(ctx context.Context, opts *RuntimeUninstallOptions) err
13061329

13071330
log.G(ctx).Infof("Uninstalling runtime \"%s\" - this process may take a few minutes...", opts.RuntimeName)
13081331

1332+
err = removeGitIntegrations(ctx, opts)
1333+
if opts.Force {
1334+
err = nil
1335+
}
1336+
handleCliStep(reporter.UninstallStepRemoveGitIntegrations, "Removing git integrations", err, true)
1337+
if err != nil {
1338+
summaryArr = append(summaryArr, summaryLog{"you can attempt to uninstall again with the \"--force\" flag", Info})
1339+
return err
1340+
}
1341+
13091342
err = apcmd.RunRepoUninstall(ctx, &apcmd.RepoUninstallOptions{
13101343
Namespace: opts.RuntimeName,
13111344
Timeout: opts.Timeout,
@@ -1314,12 +1347,13 @@ func RunRuntimeUninstall(ctx context.Context, opts *RuntimeUninstallOptions) err
13141347
Force: opts.Force,
13151348
FastExit: opts.FastExit,
13161349
})
1350+
if opts.Force {
1351+
err = nil
1352+
}
13171353
handleCliStep(reporter.UninstallStepUninstallRepo, "Uninstalling repo", err, true)
13181354
if err != nil {
1319-
if !opts.Force {
1320-
summaryArr = append(summaryArr, summaryLog{"you can attempt to uninstall again with the \"--force\" flag", Info})
1321-
return err
1322-
}
1355+
summaryArr = append(summaryArr, summaryLog{"you can attempt to uninstall again with the \"--force\" flag", Info})
1356+
return err
13231357
}
13241358

13251359
err = deleteRuntimeFromPlatform(ctx, opts)

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.0.259/cf-linux-amd64.tar.gz | tar zx
26+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.260/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.0.259/cf-darwin-amd64.tar.gz | tar zx
39+
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.260/cf-darwin-amd64.tar.gz | tar zx
4040

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

manifests/app-proxy/kustomization.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Kustomization
33
images:
44
- name: quay.io/codefresh/cap-app-proxy
55
newName: quay.io/codefresh/cap-app-proxy
6-
newTag: v0.0.27
6+
newTag: v0.0.28
77
resources:
88
- app-proxy.deploy.yaml
99
- app-proxy.svc.yaml

manifests/runtime.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
namespace: "{{ namespace }}"
66
spec:
77
defVersion: 1.0.1
8-
version: 0.0.259
8+
version: 0.0.260
99
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
1010
components:
1111
- name: events

pkg/reporter/reporter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const (
104104
UninstallPhaseStart CliStep = "uninstall.run.phase.start"
105105
UninstallStepCheckRuntimeExists CliStep = "uninstall.run.step.check-runtime-exists"
106106
UninstallStepUninstallRepo CliStep = "uninstall.run.step.uninstall-repo"
107+
UninstallStepRemoveGitIntegrations CliStep = "uninstall.run.step.remove-git-integrations"
107108
UninstallStepDeleteRuntimeFromPlatform CliStep = "uninstall.run.step.delete-runtime-from-platform"
108109
UninstallPhaseFinish CliStep = "uninstall.run.phase.finish"
109110

0 commit comments

Comments
 (0)