From 667295405bf764cf7ed6f5f02e5daafe368f2089 Mon Sep 17 00:00:00 2001 From: Janki Chhatbar Date: Mon, 9 Oct 2023 17:17:46 +0530 Subject: [PATCH] Edit arguments given to run new upgraded subctl os.Args[1:] dropped prefix `subctl` so when upgrade is run using upgraded subctl, `upgrade` is considered as the new parent command and hencce complains about the `--to-version` validity. This PR drops the arg slicing. Closes: https://github.com/submariner-io/subctl/issues/962 Signed-off-by: Janki Chhatbar --- .github/workflows/upgrade-subctl.yml | 7 +++++-- cmd/subctl/upgrade.go | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/upgrade-subctl.yml b/.github/workflows/upgrade-subctl.yml index 5a8089ed6..79da3c1ca 100644 --- a/.github/workflows/upgrade-subctl.yml +++ b/.github/workflows/upgrade-subctl.yml @@ -33,8 +33,11 @@ jobs: - name: Build new subctl run: make cmd/bin/subctl - - name: Run upgrade command - run: cmd/bin/subctl upgrade + - name: Run upgrade command and check versions after upgrade + run: | + export KUBECONFIG=$(find $(git rev-parse --show-toplevel)/output/kubeconfigs/ -type f -printf %p:) + cmd/bin/subctl upgrade + cmd/bin/subctl version && cmd/bin/subctl show versions - name: Run e2e tests run: make e2e diff --git a/cmd/subctl/upgrade.go b/cmd/subctl/upgrade.go index 2b15d7f73..20765af30 100644 --- a/cmd/subctl/upgrade.go +++ b/cmd/subctl/upgrade.go @@ -80,7 +80,7 @@ func upgrade(_ *cobra.Command, _ []string) { // Step 2a: subctl was upgraded, so run it instead of continuing cmd := exec.Cmd{ Path: command, - Args: os.Args[1:], + Args: os.Args, Stdin: os.Stdin, Stdout: os.Stdout, Stderr: os.Stderr,