Skip to content

Commit 2a1e251

Browse files
authored
Merge branch 'main' into lrochette-home-codefresh
2 parents e6838e0 + 67fda7a commit 2a1e251

File tree

5 files changed

+79
-171
lines changed

5 files changed

+79
-171
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.60
1+
VERSION=v0.1.61
22

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

cmd/commands/runtime_install.go

Lines changed: 76 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -168,94 +168,13 @@ func NewRuntimeInstallCommand() *cobra.Command {
168168
)
169169

170170
cmd := &cobra.Command{
171-
Use: "install [runtime_name]",
172-
Short: "Install a new Codefresh runtime",
173-
Example: util.Doc(`
174-
# To run this command you need to create a personal access token for your git provider
175-
# and provide it using:
176-
177-
export GIT_TOKEN=<token>
178-
179-
# or with the flag:
180-
181-
--git-token <token>
182-
183-
# Adds a new runtime
184-
185-
<BIN> runtime install runtime-name --repo gitops_repo
186-
`),
187-
PreRunE: func(cmd *cobra.Command, args []string) error {
188-
ctx := cmd.Context()
189-
190-
if len(args) > 0 {
191-
installationOpts.RuntimeName = args[0]
192-
}
193-
194-
if installationOpts.GatewayName != "" {
195-
installationOpts.useGatewayAPI = true
196-
}
197-
198-
installationOpts.RuntimeNamespace = installationOpts.RuntimeName
199-
namespace := cmd.Flag("namespace").Value.String()
200-
if namespace != "" {
201-
installationOpts.RuntimeNamespace = namespace
202-
}
203-
204-
createAnalyticsReporter(ctx, reporter.InstallFlow, installationOpts.DisableTelemetry)
205-
206-
if accessMode != "" {
207-
installationOpts.AccessMode = platmodel.AccessMode(strings.ToUpper(accessMode))
208-
if !installationOpts.AccessMode.IsValid() {
209-
return fmt.Errorf("invalid access-mode %s, must be one of: ingress|tunnel", accessMode)
210-
}
211-
212-
if installationOpts.AccessMode == platmodel.AccessModeTunnel && installationOpts.IngressHost != "" {
213-
return fmt.Errorf("ingress host can't be set when access mode is Tunnel")
214-
}
215-
}
216-
217-
err := runtimeInstallCommandPreRunHandler(cmd, installationOpts)
218-
handleCliStep(reporter.InstallPhasePreCheckFinish, "Finished pre installation checks", err, true, false)
219-
if err != nil {
220-
if errors.Is(err, promptui.ErrInterrupt) {
221-
return fmt.Errorf("installation canceled by user")
222-
}
223-
224-
util.CheckNetworkErr(err)
225-
226-
return util.DecorateErrorWithDocsLink(fmt.Errorf("pre installation error: %w", err), store.Get().RequirementsLink)
227-
}
228-
229-
finalParameters := map[string]string{
230-
"Codefresh context": cfConfig.GetCurrentContext().Name,
231-
"Kube context": installationOpts.kubeContext,
232-
"Runtime name": installationOpts.RuntimeName,
233-
"Runtime namespace": installationOpts.RuntimeNamespace,
234-
"Repository URL": installationOpts.InsCloneOpts.Repo,
235-
"Ingress class": installationOpts.IngressClass,
236-
"Installing demo resources": strconv.FormatBool(installationOpts.InstallDemoResources),
237-
"Git provider": string(installationOpts.gitProvider.Type()),
238-
}
239-
240-
if installationOpts.AccessMode == platmodel.AccessModeTunnel {
241-
finalParameters["Tunnel URL"] = installationOpts.IngressHost
242-
finalParameters["Access mode"] = "Codefresh tunnel-based"
243-
} else {
244-
finalParameters["Ingress host"] = installationOpts.IngressHost
245-
finalParameters["Internal ingress host"] = installationOpts.InternalIngressHost
246-
finalParameters["Access mode"] = "Ingress-based"
247-
}
248-
249-
if err := getApprovalFromUser(ctx, finalParameters, "runtime install"); err != nil {
250-
return err
251-
}
252-
253-
return nil
254-
},
171+
Use: "install [runtime_name]",
172+
Deprecated: "We have transitioned our GitOps Runtimes from CLI-based to Helm-based installation.",
255173
RunE: func(cmd *cobra.Command, _ []string) error {
256-
err := runRuntimeInstall(cmd, installationOpts)
257-
handleCliStep(reporter.InstallPhaseFinish, "Runtime installation phase finished", err, false, false)
258-
return err
174+
return errors.New(`We have transitioned our GitOps Runtimes from CLI-based to Helm-based installation.
175+
As of January 30, 2024, CLI-based Runtimes are no longer supported.
176+
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).
177+
For Helm installation, review our documentation on installing Hybrid GitOps Runtimes (https://codefresh.io/docs/docs/installation/gitops/hybrid-gitops-helm-installation).`)
259178
},
260179
}
261180

@@ -313,6 +232,75 @@ func NewRuntimeInstallCommand() *cobra.Command {
313232
return cmd
314233
}
315234

235+
func PreRunE(cmd *cobra.Command, args []string, installationOpts *RuntimeInstallOptions, accessMode string) error {
236+
ctx := cmd.Context()
237+
238+
if len(args) > 0 {
239+
installationOpts.RuntimeName = args[0]
240+
}
241+
242+
if installationOpts.GatewayName != "" {
243+
installationOpts.useGatewayAPI = true
244+
}
245+
246+
installationOpts.RuntimeNamespace = installationOpts.RuntimeName
247+
namespace := cmd.Flag("namespace").Value.String()
248+
if namespace != "" {
249+
installationOpts.RuntimeNamespace = namespace
250+
}
251+
252+
createAnalyticsReporter(ctx, reporter.InstallFlow, installationOpts.DisableTelemetry)
253+
254+
if accessMode != "" {
255+
installationOpts.AccessMode = platmodel.AccessMode(strings.ToUpper(accessMode))
256+
if !installationOpts.AccessMode.IsValid() {
257+
return fmt.Errorf("invalid access-mode %s, must be one of: ingress|tunnel", accessMode)
258+
}
259+
260+
if installationOpts.AccessMode == platmodel.AccessModeTunnel && installationOpts.IngressHost != "" {
261+
return fmt.Errorf("ingress host can't be set when access mode is Tunnel")
262+
}
263+
}
264+
265+
err := runtimeInstallCommandPreRunHandler(cmd, installationOpts)
266+
handleCliStep(reporter.InstallPhasePreCheckFinish, "Finished pre installation checks", err, true, false)
267+
if err != nil {
268+
if errors.Is(err, promptui.ErrInterrupt) {
269+
return fmt.Errorf("installation canceled by user")
270+
}
271+
272+
util.CheckNetworkErr(err)
273+
274+
return util.DecorateErrorWithDocsLink(fmt.Errorf("pre installation error: %w", err), store.Get().RequirementsLink)
275+
}
276+
277+
finalParameters := map[string]string{
278+
"Codefresh context": cfConfig.GetCurrentContext().Name,
279+
"Kube context": installationOpts.kubeContext,
280+
"Runtime name": installationOpts.RuntimeName,
281+
"Runtime namespace": installationOpts.RuntimeNamespace,
282+
"Repository URL": installationOpts.InsCloneOpts.Repo,
283+
"Ingress class": installationOpts.IngressClass,
284+
"Installing demo resources": strconv.FormatBool(installationOpts.InstallDemoResources),
285+
"Git provider": string(installationOpts.gitProvider.Type()),
286+
}
287+
288+
if installationOpts.AccessMode == platmodel.AccessModeTunnel {
289+
finalParameters["Tunnel URL"] = installationOpts.IngressHost
290+
finalParameters["Access mode"] = "Codefresh tunnel-based"
291+
} else {
292+
finalParameters["Ingress host"] = installationOpts.IngressHost
293+
finalParameters["Internal ingress host"] = installationOpts.InternalIngressHost
294+
finalParameters["Access mode"] = "Ingress-based"
295+
}
296+
297+
if err := getApprovalFromUser(ctx, finalParameters, "runtime install"); err != nil {
298+
return err
299+
}
300+
301+
return nil
302+
}
303+
316304
func runtimeInstallCommandPreRunHandler(cmd *cobra.Command, opts *RuntimeInstallOptions) error {
317305
var err error
318306
ctx := cmd.Context()
@@ -643,7 +631,7 @@ func createRuntimeOnPlatform(ctx context.Context, opts *RuntimeInstallOptions, r
643631
return runtimeCreationResponse.NewAccessToken, hex.EncodeToString(iv), nil
644632
}
645633

646-
func runRuntimeInstall(cmd *cobra.Command, opts *RuntimeInstallOptions) error {
634+
func RunRuntimeInstall(cmd *cobra.Command, opts *RuntimeInstallOptions) error {
647635
ctx := cmd.Context()
648636
rt, err := preInstallationChecks(cmd, opts)
649637
handleCliStep(reporter.InstallPhaseRunPreCheckFinish, "Pre run installation checks", err, true, true)

docs/commands/cli-v2_runtime.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ cli-v2 runtime [flags]
2626
### SEE ALSO
2727

2828
* [cli-v2](cli-v2.md) - cli-v2 is used for installing and managing codefresh installations using gitops
29-
* [cli-v2 runtime install](cli-v2_runtime_install.md) - Install a new Codefresh runtime
3029
* [cli-v2 runtime list](cli-v2_runtime_list.md) - List all Codefresh runtimes
3130
* [cli-v2 runtime logs](cli-v2_runtime_logs.md) - Work with current runtime logs
3231
* [cli-v2 runtime uninstall](cli-v2_runtime_uninstall.md) - Uninstall a Codefresh runtime

docs/commands/cli-v2_runtime_install.md

Lines changed: 0 additions & 79 deletions
This file was deleted.

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