Skip to content

Commit 0a0a848

Browse files
authored
CR-15313-invalid-tunnel-url (#632)
* moved tunnel ingressHost calc into runtimeInstallCommandPreRunHandler
1 parent 4c25ce7 commit 0a0a848

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* roi.kramer@codefresh.io noam.gal@codefresh.io daniel.maizel@codefresh.io pavel@codefresh.io ziv@codefresh.io itai@codefresh.io
1+
* roi.kramer@codefresh.io noam.gal@codefresh.io daniel.maizel@codefresh.io pavel@codefresh.io ziv@codefresh.io itai@codefresh.io daniel.soifer@codefresh.io

Makefile

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

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

cmd/commands/runtime_install.go

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -201,17 +201,6 @@ func NewRuntimeInstallCommand() *cobra.Command {
201201
return fmt.Errorf("invalid access-mode %s, must be one of: ingress|tunnel", accessMode)
202202
}
203203

204-
if installationOpts.AccessMode == platmodel.AccessModeTunnel {
205-
installationOpts.featuresToInstall = append(installationOpts.featuresToInstall, runtime.InstallFeatureIngressless)
206-
accountId, err := cfConfig.GetCurrentContext().GetAccountId(ctx)
207-
if err != nil {
208-
return fmt.Errorf("failed creating ingressHost for tunnel: %w", err)
209-
}
210-
211-
installationOpts.TunnelSubdomain = fmt.Sprintf("%s-%s", accountId, installationOpts.RuntimeName)
212-
installationOpts.IngressHost = fmt.Sprintf("https://%s.%s", installationOpts.TunnelSubdomain, installationOpts.TunnelDomain)
213-
}
214-
215204
err := runtimeInstallCommandPreRunHandler(cmd, installationOpts)
216205
handleCliStep(reporter.InstallPhasePreCheckFinish, "Finished pre installation checks", err, true, false)
217206
if err != nil {
@@ -222,21 +211,22 @@ func NewRuntimeInstallCommand() *cobra.Command {
222211
return util.DecorateErrorWithDocsLink(fmt.Errorf("pre installation error: %w", err), store.Get().RequirementsLink)
223212
}
224213

225-
if installationOpts.runtimeDef == "" {
226-
installationOpts.runtimeDef = runtime.GetRuntimeDefURL(installationOpts.versionStr)
227-
}
228-
229214
finalParameters = map[string]string{
230215
"Codefresh context": cfConfig.CurrentContext,
231216
"Kube context": installationOpts.kubeContext,
232217
"Runtime name": installationOpts.RuntimeName,
233218
"Repository URL": installationOpts.InsCloneOpts.Repo,
234-
"Ingress host": installationOpts.IngressHost,
235219
"Ingress class": installationOpts.IngressClass,
236-
"Internal ingress host": installationOpts.InternalIngressHost,
237220
"Installing demo resources": strconv.FormatBool(installationOpts.InstallDemoResources),
238221
}
239222

223+
if installationOpts.AccessMode == platmodel.AccessModeTunnel {
224+
finalParameters["Tunnel URL"] = installationOpts.IngressHost
225+
} else {
226+
finalParameters["Ingress host"] = installationOpts.IngressHost
227+
finalParameters["Internal ingress host"] = installationOpts.InternalIngressHost
228+
}
229+
240230
if err := getApprovalFromUser(ctx, finalParameters, "runtime install"); err != nil {
241231
return err
242232
}
@@ -339,6 +329,14 @@ func runtimeInstallCommandPreRunHandler(cmd *cobra.Command, opts *RuntimeInstall
339329
if opts.AccessMode == platmodel.AccessModeTunnel {
340330
handleCliStep(reporter.InstallStepPreCheckEnsureIngressClass, "-skipped (ingressless)-", err, true, false)
341331
handleCliStep(reporter.InstallStepPreCheckEnsureIngressHost, "-skipped (ingressless)-", err, true, false)
332+
opts.featuresToInstall = append(opts.featuresToInstall, runtime.InstallFeatureIngressless)
333+
accountId, err := cfConfig.GetCurrentContext().GetAccountId(ctx)
334+
if err != nil {
335+
return fmt.Errorf("failed creating ingressHost for tunnel: %w", err)
336+
}
337+
338+
opts.TunnelSubdomain = fmt.Sprintf("%s-%s", accountId, opts.RuntimeName)
339+
opts.IngressHost = fmt.Sprintf("https://%s.%s", opts.TunnelSubdomain, opts.TunnelDomain)
342340
} else {
343341
err = ensureRoutingControllerSupported(ctx, opts)
344342
handleCliStep(reporter.InstallStepPreCheckEnsureIngressClass, "Getting ingress class", err, true, false)
@@ -387,6 +385,10 @@ func runtimeInstallCommandPreRunHandler(cmd *cobra.Command, opts *RuntimeInstall
387385
log.G(ctx).Infof("using repo '%s' as shared config repo for this account", sharedConfigRepo)
388386
}
389387

388+
if opts.runtimeDef == "" {
389+
opts.runtimeDef = runtime.GetRuntimeDefURL(opts.versionStr)
390+
}
391+
390392
opts.Insecure = true // installs argo-cd in insecure mode, we need this so that the eventsource can talk to the argocd-server with http
391393
opts.CommonConfig = &runtime.CommonConfig{CodefreshBaseURL: cfConfig.GetCurrentContext().URL}
392394

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