diff --git a/Makefile b/Makefile index bc614437..56e3f6ef 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=v0.1.60 +VERSION=v0.1.61 OUT_DIR=dist YEAR?=$(shell date +"%Y") diff --git a/cmd/commands/runtime_install.go b/cmd/commands/runtime_install.go index a9bfec05..3f5c7717 100644 --- a/cmd/commands/runtime_install.go +++ b/cmd/commands/runtime_install.go @@ -168,94 +168,13 @@ func NewRuntimeInstallCommand() *cobra.Command { ) cmd := &cobra.Command{ - Use: "install [runtime_name]", - Short: "Install a new Codefresh runtime", - Example: util.Doc(` -# To run this command you need to create a personal access token for your git provider -# and provide it using: - - export GIT_TOKEN= - -# or with the flag: - - --git-token - -# Adds a new runtime - - runtime install runtime-name --repo gitops_repo -`), - PreRunE: func(cmd *cobra.Command, args []string) error { - ctx := cmd.Context() - - if len(args) > 0 { - installationOpts.RuntimeName = args[0] - } - - if installationOpts.GatewayName != "" { - installationOpts.useGatewayAPI = true - } - - installationOpts.RuntimeNamespace = installationOpts.RuntimeName - namespace := cmd.Flag("namespace").Value.String() - if namespace != "" { - installationOpts.RuntimeNamespace = namespace - } - - createAnalyticsReporter(ctx, reporter.InstallFlow, installationOpts.DisableTelemetry) - - if accessMode != "" { - installationOpts.AccessMode = platmodel.AccessMode(strings.ToUpper(accessMode)) - if !installationOpts.AccessMode.IsValid() { - return fmt.Errorf("invalid access-mode %s, must be one of: ingress|tunnel", accessMode) - } - - if installationOpts.AccessMode == platmodel.AccessModeTunnel && installationOpts.IngressHost != "" { - return fmt.Errorf("ingress host can't be set when access mode is Tunnel") - } - } - - err := runtimeInstallCommandPreRunHandler(cmd, installationOpts) - handleCliStep(reporter.InstallPhasePreCheckFinish, "Finished pre installation checks", err, true, false) - if err != nil { - if errors.Is(err, promptui.ErrInterrupt) { - return fmt.Errorf("installation canceled by user") - } - - util.CheckNetworkErr(err) - - return util.DecorateErrorWithDocsLink(fmt.Errorf("pre installation error: %w", err), store.Get().RequirementsLink) - } - - finalParameters := map[string]string{ - "Codefresh context": cfConfig.GetCurrentContext().Name, - "Kube context": installationOpts.kubeContext, - "Runtime name": installationOpts.RuntimeName, - "Runtime namespace": installationOpts.RuntimeNamespace, - "Repository URL": installationOpts.InsCloneOpts.Repo, - "Ingress class": installationOpts.IngressClass, - "Installing demo resources": strconv.FormatBool(installationOpts.InstallDemoResources), - "Git provider": string(installationOpts.gitProvider.Type()), - } - - if installationOpts.AccessMode == platmodel.AccessModeTunnel { - finalParameters["Tunnel URL"] = installationOpts.IngressHost - finalParameters["Access mode"] = "Codefresh tunnel-based" - } else { - finalParameters["Ingress host"] = installationOpts.IngressHost - finalParameters["Internal ingress host"] = installationOpts.InternalIngressHost - finalParameters["Access mode"] = "Ingress-based" - } - - if err := getApprovalFromUser(ctx, finalParameters, "runtime install"); err != nil { - return err - } - - return nil - }, + Use: "install [runtime_name]", + Deprecated: "We have transitioned our GitOps Runtimes from CLI-based to Helm-based installation.", RunE: func(cmd *cobra.Command, _ []string) error { - err := runRuntimeInstall(cmd, installationOpts) - handleCliStep(reporter.InstallPhaseFinish, "Runtime installation phase finished", err, false, false) - return err + return errors.New(`We have transitioned our GitOps Runtimes from CLI-based to Helm-based installation. +As of January 30, 2024, CLI-based Runtimes are no longer supported. +If you're currently using CLI-based Hybrid GitOps Runtimes, we encourage you to migrate to Helm by following our migration guidelines (https://codefresh.io/docs/docs/installation/gitops/migrate-cli-runtimes-helm). +For Helm installation, review our documentation on installing Hybrid GitOps Runtimes (https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation).`) }, } @@ -313,6 +232,75 @@ func NewRuntimeInstallCommand() *cobra.Command { return cmd } +func PreRunE(cmd *cobra.Command, args []string, installationOpts *RuntimeInstallOptions, accessMode string) error { + ctx := cmd.Context() + + if len(args) > 0 { + installationOpts.RuntimeName = args[0] + } + + if installationOpts.GatewayName != "" { + installationOpts.useGatewayAPI = true + } + + installationOpts.RuntimeNamespace = installationOpts.RuntimeName + namespace := cmd.Flag("namespace").Value.String() + if namespace != "" { + installationOpts.RuntimeNamespace = namespace + } + + createAnalyticsReporter(ctx, reporter.InstallFlow, installationOpts.DisableTelemetry) + + if accessMode != "" { + installationOpts.AccessMode = platmodel.AccessMode(strings.ToUpper(accessMode)) + if !installationOpts.AccessMode.IsValid() { + return fmt.Errorf("invalid access-mode %s, must be one of: ingress|tunnel", accessMode) + } + + if installationOpts.AccessMode == platmodel.AccessModeTunnel && installationOpts.IngressHost != "" { + return fmt.Errorf("ingress host can't be set when access mode is Tunnel") + } + } + + err := runtimeInstallCommandPreRunHandler(cmd, installationOpts) + handleCliStep(reporter.InstallPhasePreCheckFinish, "Finished pre installation checks", err, true, false) + if err != nil { + if errors.Is(err, promptui.ErrInterrupt) { + return fmt.Errorf("installation canceled by user") + } + + util.CheckNetworkErr(err) + + return util.DecorateErrorWithDocsLink(fmt.Errorf("pre installation error: %w", err), store.Get().RequirementsLink) + } + + finalParameters := map[string]string{ + "Codefresh context": cfConfig.GetCurrentContext().Name, + "Kube context": installationOpts.kubeContext, + "Runtime name": installationOpts.RuntimeName, + "Runtime namespace": installationOpts.RuntimeNamespace, + "Repository URL": installationOpts.InsCloneOpts.Repo, + "Ingress class": installationOpts.IngressClass, + "Installing demo resources": strconv.FormatBool(installationOpts.InstallDemoResources), + "Git provider": string(installationOpts.gitProvider.Type()), + } + + if installationOpts.AccessMode == platmodel.AccessModeTunnel { + finalParameters["Tunnel URL"] = installationOpts.IngressHost + finalParameters["Access mode"] = "Codefresh tunnel-based" + } else { + finalParameters["Ingress host"] = installationOpts.IngressHost + finalParameters["Internal ingress host"] = installationOpts.InternalIngressHost + finalParameters["Access mode"] = "Ingress-based" + } + + if err := getApprovalFromUser(ctx, finalParameters, "runtime install"); err != nil { + return err + } + + return nil +} + func runtimeInstallCommandPreRunHandler(cmd *cobra.Command, opts *RuntimeInstallOptions) error { var err error ctx := cmd.Context() @@ -643,7 +631,7 @@ func createRuntimeOnPlatform(ctx context.Context, opts *RuntimeInstallOptions, r return runtimeCreationResponse.NewAccessToken, hex.EncodeToString(iv), nil } -func runRuntimeInstall(cmd *cobra.Command, opts *RuntimeInstallOptions) error { +func RunRuntimeInstall(cmd *cobra.Command, opts *RuntimeInstallOptions) error { ctx := cmd.Context() rt, err := preInstallationChecks(cmd, opts) handleCliStep(reporter.InstallPhaseRunPreCheckFinish, "Pre run installation checks", err, true, true) diff --git a/docs/commands/cli-v2_runtime.md b/docs/commands/cli-v2_runtime.md index affe90cf..b1abe86e 100644 --- a/docs/commands/cli-v2_runtime.md +++ b/docs/commands/cli-v2_runtime.md @@ -26,7 +26,6 @@ cli-v2 runtime [flags] ### SEE ALSO * [cli-v2](cli-v2.md) - cli-v2 is used for installing and managing codefresh installations using gitops -* [cli-v2 runtime install](cli-v2_runtime_install.md) - Install a new Codefresh runtime * [cli-v2 runtime list](cli-v2_runtime_list.md) - List all Codefresh runtimes * [cli-v2 runtime logs](cli-v2_runtime_logs.md) - Work with current runtime logs * [cli-v2 runtime uninstall](cli-v2_runtime_uninstall.md) - Uninstall a Codefresh runtime diff --git a/docs/commands/cli-v2_runtime_install.md b/docs/commands/cli-v2_runtime_install.md deleted file mode 100644 index 4f56ef74..00000000 --- a/docs/commands/cli-v2_runtime_install.md +++ /dev/null @@ -1,79 +0,0 @@ -## cli-v2 runtime install - -Install a new Codefresh runtime - -``` -cli-v2 runtime install [runtime_name] [flags] -``` - -### Examples - -``` - -# To run this command you need to create a personal access token for your git provider -# and provide it using: - - export GIT_TOKEN= - -# or with the flag: - - --git-token - -# Adds a new runtime - - cli-v2 runtime install runtime-name --repo gitops_repo - -``` - -### Options - -``` - --access-mode string The access mode to the cluster, one of: ingress|tunnel - --context string The name of the kubeconfig context to use - --demo-resources Installs demo resources (default: true) (default true) - --disable-rollback If true, will not perform installation rollback after a failed installation - --disable-telemetry If true, will disable the analytics reporting for the installation process - --external-ingress-annotation stringToString Add annotations to the external ingress. (e.g. "key1=value1,key2=value2") (default []) - --from-repo Installs a runtime from an existing repo. Used for recovery after cluster failure - --gateway-name string The gateway name - --gateway-namespace string The namespace of the gateway - --git-server-crt string Git Server certificate file - -t, --git-token string Your git provider api token [GIT_TOKEN] - -u, --git-user string Your git provider user name [GIT_USER] (not required in GitHub) - -h, --help help for install - --ingress-class string The ingress class name - --ingress-host string The ingress host - --internal-ingress-annotation stringToString Add annotations to the internal ingress. (e.g. "key1=value1,key2=value2") (default []) - --internal-ingress-host string The internal ingress host (by default the external ingress will be used for both internal and external traffic) - --kubeconfig string Path to the kubeconfig file to use for CLI requests. - -n, --namespace string If present, the namespace scope for this CLI request - --namespace-labels stringToString Optional labels that will be set on the namespace resource. (e.g. "key1=value1,key2=value2") (default []) - --personal-git-token string The Personal git token for your user - --personal-git-user string The Personal git user that match the token, required for bitbucket cloud - --provider string The git provider, one of: azure|bitbucket|bitbucket-server|gitea|github|gitlab - --provider-api-url string Git provider API url - --repo string Repository URL [GIT_REPO] - --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") - --shared-config-repo string URL to the shared configurations repo. (default: or the existing one for this account) - --skip-cluster-checks Skips the cluster's checks - --skip-ingress Skips the creation of ingress resources - --skip-permissions-validation Skip personal access token permissions validation (default: false) - -b, --upsert-branch If true will try to checkout the specified branch and create it if it doesn't exist - --version string The runtime version to install (default: stable) - --wait-timeout duration How long to wait for the runtime components to be ready (default 8m0s) -``` - -### Options inherited from parent commands - -``` - --auth-context string Run the next command using a specific authentication context - --cfconfig string Custom path for authentication contexts config file (default "/home/user") - --insecure Disable certificate validation for TLS connections (e.g. to g.codefresh.io) - --insecure-ingress-host Disable certificate validation of ingress host (default: false) - --silent Disables the command wizard -``` - -### SEE ALSO - -* [cli-v2 runtime](cli-v2_runtime.md) - Manage Codefresh runtimes - diff --git a/docs/releases/release_notes.md b/docs/releases/release_notes.md index f3ca9102..3863d48f 100644 --- a/docs/releases/release_notes.md +++ b/docs/releases/release_notes.md @@ -23,7 +23,7 @@ cf version ```bash # download and extract the binary -curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.60/cf-linux-amd64.tar.gz | tar zx +curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.61/cf-linux-amd64.tar.gz | tar zx # move the binary to your $PATH mv ./cf-linux-amd64 /usr/local/bin/cf @@ -36,7 +36,7 @@ cf version ```bash # download and extract the binary -curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.60/cf-darwin-amd64.tar.gz | tar zx +curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.61/cf-darwin-amd64.tar.gz | tar zx # move the binary to your $PATH mv ./cf-darwin-amd64 /usr/local/bin/cf