Skip to content

Commit b5f8c03

Browse files
Add validation to block usage of --ingress-host flag together with --… (#648)
* Add validation to block usage of --ingress-host flag together with --access-mode=tunnel * fix according to code review
1 parent 0d06e8b commit b5f8c03

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
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.10
1+
VERSION=v0.1.11
22

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

cmd/commands/runtime_install.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ type (
109109
IpsAllowList string
110110
SkipIngress bool
111111
BypassIngressClassCheck bool
112-
DownloadRuntimeDef *runtime.Runtime
113112

114113
versionStr string
115114
kubeContext string
@@ -196,11 +195,15 @@ func NewRuntimeInstallCommand() *cobra.Command {
196195

197196
createAnalyticsReporter(ctx, reporter.InstallFlow, installationOpts.DisableTelemetry)
198197

199-
if (accessMode != "") {
198+
if accessMode != "" {
200199
installationOpts.AccessMode = platmodel.AccessMode(strings.ToUpper(accessMode))
201200
if !installationOpts.AccessMode.IsValid() {
202201
return fmt.Errorf("invalid access-mode %s, must be one of: ingress|tunnel", accessMode)
203202
}
203+
204+
if installationOpts.AccessMode == platmodel.AccessModeTunnel && installationOpts.IngressHost != "" {
205+
return fmt.Errorf("ingress host can't be set when access mode is Tunnel")
206+
}
204207
}
205208

206209
err := runtimeInstallCommandPreRunHandler(cmd, installationOpts)
@@ -394,7 +397,6 @@ func runtimeInstallCommandPreRunHandler(cmd *cobra.Command, opts *RuntimeInstall
394397

395398
opts.Insecure = true // installs argo-cd in insecure mode, we need this so that the eventsource can talk to the argocd-server with http
396399
opts.CommonConfig = &runtime.CommonConfig{CodefreshBaseURL: cfConfig.GetCurrentContext().URL}
397-
opts.DownloadRuntimeDef = rt
398400

399401
return nil
400402
}
@@ -1145,7 +1147,11 @@ func preInstallationChecks(ctx context.Context, opts *RuntimeInstallOptions) (*r
11451147
return nil, err
11461148
}
11471149

1148-
rt := opts.DownloadRuntimeDef
1150+
runtimeDef := getRuntimeDef(opts.runtimeDef, opts.versionStr)
1151+
rt, err := runtime.Download(runtimeDef, opts.RuntimeName, opts.featuresToInstall)
1152+
if err != nil {
1153+
return nil, fmt.Errorf("failed to download runtime definition: %w", err)
1154+
}
11491155

11501156
handleCliStep(reporter.InstallStepRunPreCheckEnsureCliVersion, "Checking CLI version", err, true, false)
11511157
if err != nil {

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