duo cli: GLAB_DUO_CLI_BINARY_PATH ignored on unsupported architectures (s390x/ppc64le), causing early ErrUnsupportedPlatform and failing custom-path validation
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "bug" label: - https://gitlab.com/gitlab-org/cli/-/issues/?label_name%5B%5D=type%3A%3Abug and verify the issue you're about to submit isn't a duplicate. ---> ### Checklist <!-- Please test the latest versions, that will remove the possibility that you see a bug that is fixed in a newer version. --> - [x] I'm using the latest version of the extension (Run `glab --version`) - [x] Operating system and version: Fedora 43 ### Summary <!-- Summarize the bug encountered concisely --> On architectures where GitLab does not publish Duo CLI binaries (like `s390x`, `ppc64le`), `glab duo cli` returns unsupported platform even when `GLAB_DUO_CLI_BINARY_PATH` is set. This prevents custom-binary workflows and causes unit tests like `TestRunWithCustomPath_Validation` to fail because the code errors out before reaching `validateBinaryPath`. ### Environment <!-- on POSIX system (Linux, MacOS), run bash -c 'printf -- "- OS: %s\n- SHELL: %s\n- TERM: %s\n- GLAB: %s" "$(uname -srm)" "$SHELL" "$TERM" "$(glab --version)"' and replace the following section with the result. If you use non-POSIX system, fill in the section manually: - OS: Your operating system including version and architecture (Windows 11 - AMD64, MacOS Sonoma - ARM64) - SHELL: Your shell (bash, fish, zsh, ...) - TERM: Your terminal emulator (Kitty, Xterm2..) - GLAB: result of running `glab --version` (glab version 1.32.0 (2023-08-18)) --> - OS: Fedora Rawhide ppc64le & s390x (and riscv in the future) - SHELL: bash - TERM: gnome-terminal - GLAB: 1.92.1 <!-- Please include any other information that you believe might be relevant in debugging. For example, you may include a shell framework like oh-my-zsh or other customizations like editing the prompt (PS1, PS2, and others). --> Other: ### Steps to reproduce 1. Run the tests on a `s390x` or `ppc64le` would fail in `TestDetectPlatform` and `TestRunWithCustomPath_Validation`. <!-- How one can reproduce the issue - this is very important --> ### What is the current _bug_ behavior? <!-- What actually happens --> ### What is the expected _correct_ behavior? When `GLAB_DUO_CLI_BINARY_PATH` / `duo_cli_binary_path` is set, `glab duo cli` should validate that path and proceed (or return the clear validation errors), even if the host arch is not supported for managed downloads. Also, unit tests should not fail in non-supported architectures. Tests already skip non-supported scenarios, but the validation makes them fail. ### Relevant logs and/or screenshots ~~~ --- FAIL: TestRunWithCustomPath_Validation (0.00s) --- FAIL: TestRunWithCustomPath_Validation/non-existent_path_returns_clear_error (0.00s) cli_test.go:50: Error Trace: /builddir/build/BUILD/glab-1.92.1-build/cli-v1.92.1/internal/commands/duo/cli/cli_test.go:50 Error: "unsupported platform: architecture s390x (supported: amd64/x64, arm64)" does not contain "GLAB_DUO_CLI_BINARY_PATH is set to" Test: TestRunWithCustomPath_Validation/non-existent_path_returns_clear_error cli_test.go:51: Error Trace: /builddir/build/BUILD/glab-1.92.1-build/cli-v1.92.1/internal/commands/duo/cli/cli_test.go:51 Error: "unsupported platform: architecture s390x (supported: amd64/x64, arm64)" does not contain "/nonexistent/path/to/duo" Test: TestRunWithCustomPath_Validation/non-existent_path_returns_clear_error cli_test.go:52: Error Trace: /builddir/build/BUILD/glab-1.92.1-build/cli-v1.92.1/internal/commands/duo/cli/cli_test.go:52 Error: "unsupported platform: architecture s390x (supported: amd64/x64, arm64)" does not contain "file was not found" Test: TestRunWithCustomPath_Validation/non-existent_path_returns_clear_error --- FAIL: TestRunWithCustomPath_Validation/directory_path_returns_clear_error (0.00s) cli_test.go:68: Error Trace: /builddir/build/BUILD/glab-1.92.1-build/cli-v1.92.1/internal/commands/duo/cli/cli_test.go:68 Error: "unsupported platform: architecture s390x (supported: amd64/x64, arm64)" does not contain "GLAB_DUO_CLI_BINARY_PATH is set to" Test: TestRunWithCustomPath_Validation/directory_path_returns_clear_error cli_test.go:69: Error Trace: /builddir/build/BUILD/glab-1.92.1-build/cli-v1.92.1/internal/commands/duo/cli/cli_test.go:69 Error: "unsupported platform: architecture s390x (supported: amd64/x64, arm64)" does not contain "it is a directory, not an executable file" Test: TestRunWithCustomPath_Validation/directory_path_returns_clear_error --- FAIL: TestRunWithCustomPath_Validation/non-executable_file_returns_clear_error (0.00s) cli_test.go:88: Error Trace: /builddir/build/BUILD/glab-1.92.1-build/cli-v1.92.1/internal/commands/duo/cli/cli_test.go:88 Error: "unsupported platform: architecture s390x (supported: amd64/x64, arm64)" does not contain "GLAB_DUO_CLI_BINARY_PATH is set to" Test: TestRunWithCustomPath_Validation/non-executable_file_returns_clear_error cli_test.go:89: Error Trace: /builddir/build/BUILD/glab-1.92.1-build/cli-v1.92.1/internal/commands/duo/cli/cli_test.go:89 Error: "unsupported platform: architecture s390x (supported: amd64/x64, arm64)" does not contain "file is not executable" Test: TestRunWithCustomPath_Validation/non-executable_file_returns_clear_error cli_test.go:90: Error Trace: /builddir/build/BUILD/glab-1.92.1-build/cli-v1.92.1/internal/commands/duo/cli/cli_test.go:90 Error: "unsupported platform: architecture s390x (supported: amd64/x64, arm64)" does not contain "chmod +x" Test: TestRunWithCustomPath_Validation/non-executable_file_returns_clear_error FAIL FAIL gitlab.com/gitlab-org/cli/internal/commands/duo/cli 0.023s ~~~ <!--- Paste the activity log from your command line --> ### Possible fixes Merge request will be opened.
issue