From 0817f17cbe7744886c7ed0b5c51f2893898f0c6a Mon Sep 17 00:00:00 2001 From: Noam Gal Date: Sun, 25 Jul 2021 19:08:47 +0300 Subject: [PATCH] simplify flags (#28) * removed "install-" flag prefixes * added install/uninstall info messages --- Makefile | 2 +- cmd/commands/runtime.go | 12 ++++++++++-- docs/commands/cli-v2_runtime_install.md | 6 +++--- docs/releases/release_notes.md | 4 ++-- manifests/runtime.yaml | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 89ac37f5f..177c5f447 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=v0.0.33 +VERSION=v0.0.34 OUT_DIR=dist YEAR?=$(shell date +"%Y") diff --git a/cmd/commands/runtime.go b/cmd/commands/runtime.go index 272775a8f..37ac1065d 100644 --- a/cmd/commands/runtime.go +++ b/cmd/commands/runtime.go @@ -157,7 +157,6 @@ func NewRuntimeInstallCommand() *cobra.Command { cmd.Flags().StringVar(&versionStr, "version", "", "The runtime version to install, defaults to latest") insCloneOpts = git.AddFlags(cmd, &git.AddFlagsOptions{ - Prefix: "install", CreateIfNotExist: true, FS: memfs.New(), }) @@ -178,6 +177,7 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error { return fmt.Errorf("failed to download runtime definition: %w", err) } + log.G(ctx).WithField("version", rt.Spec.Version).Infof("installing runtime '%s'", opts.RuntimeName) err = apcmd.RunRepoBootstrap(ctx, &apcmd.RepoBootstrapOptions{ AppSpecifier: rt.Spec.FullSpecifier(), Namespace: opts.RuntimeName, @@ -219,6 +219,7 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error { return fmt.Errorf("failed to create `%s`: %w", store.Get().GitSourceName, err) } + log.G(ctx).Infof("done installing runtime '%s'", opts.RuntimeName) return nil } @@ -332,12 +333,19 @@ func NewRuntimeUninsatllCommand() *cobra.Command { } func RunRuntimeUninstall(ctx context.Context, opts *RuntimeUninstallOptions) error { - return apcmd.RunRepoUninstall(ctx, &apcmd.RepoUninstallOptions{ + log.G(ctx).Infof("uninstalling runtime '%s'", opts.RuntimeName) + err := apcmd.RunRepoUninstall(ctx, &apcmd.RepoUninstallOptions{ Namespace: opts.RuntimeName, Timeout: opts.Timeout, CloneOptions: opts.CloneOpts, KubeFactory: opts.KubeFactory, }) + if err != nil { + return fmt.Errorf("failed uninstalling runtime: %w", err) + } + + log.G(ctx).Infof("done uninstalling runtime '%s'", opts.RuntimeName) + return nil } func NewRuntimeUpgradeCommand() *cobra.Command { diff --git a/docs/commands/cli-v2_runtime_install.md b/docs/commands/cli-v2_runtime_install.md index 705aec89f..0f98047c8 100644 --- a/docs/commands/cli-v2_runtime_install.md +++ b/docs/commands/cli-v2_runtime_install.md @@ -31,12 +31,12 @@ cli-v2 runtime install [runtime_name] [flags] --git-src-git-token string Your git provider api token [GIT_SRC_GIT_TOKEN] --git-src-provider string The git provider, one of: gitea|github --git-src-repo string Repository URL [GIT_SRC_GIT_REPO] + -t, --git-token string Your git provider api token [GIT_TOKEN] -h, --help help for install - --install-git-token string Your git provider api token [INSTALL_GIT_TOKEN] - --install-provider string The git provider, one of: gitea|github - --install-repo string Repository URL [INSTALL_GIT_REPO] --kubeconfig string Path to the kubeconfig file to use for CLI requests. -n, --namespace string If present, the namespace scope for this CLI request + --provider string The git provider, one of: gitea|github + --repo string Repository URL [GIT_REPO] --version string The runtime version to install, defaults to latest ``` diff --git a/docs/releases/release_notes.md b/docs/releases/release_notes.md index 039369d33..38b2c784c 100644 --- a/docs/releases/release_notes.md +++ b/docs/releases/release_notes.md @@ -8,7 +8,7 @@ ### Linux ```bash # download and extract the binary -curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.32/cf-linux-amd64.tar.gz | tar zx +curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.34/cf-linux-amd64.tar.gz | tar zx # move the binary to your $PATH mv ./cf-linux-amd64 /usr/local/bin/cf @@ -20,7 +20,7 @@ cf version ### Mac ```bash # download and extract the binary -curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.32/cf-darwin-amd64.tar.gz | tar zx +curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.34/cf-darwin-amd64.tar.gz | tar zx # move the binary to your $PATH mv ./cf-darwin-amd64 /usr/local/bin/cf diff --git a/manifests/runtime.yaml b/manifests/runtime.yaml index e8517627a..1ca4f45e4 100644 --- a/manifests/runtime.yaml +++ b/manifests/runtime.yaml @@ -5,7 +5,7 @@ metadata: namespace: "{{ namespace }}" spec: defVersion: 1.0.0 - version: 0.0.32 + version: 0.0.34 bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd components: - name: events