Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update chocolatey installer #665

Merged

Conversation

chandrareddyp
Copy link
Contributor

@chandrareddyp chandrareddyp commented Jan 31, 2024

What this PR does / why we need it

When installing the latest CLI version v1.2.0-rc.0 using Chocolatey, there is an issue with the spinner when installing plugins. If Ctrl+C is pressed while the spinner is running, it does not properly handle the interrupt and terminate the spinner. Instead, the CLI hangs without returning an error.

The root cause is the Windows Chocolatey install wrapper or shim that gets created for the tanzu executable. This wrapper kills the CLI process on Ctrl+C without allowing the CLI to catch the interrupt itself. There is a long-standing open issue on this behavior: chocolatey/home#134

This PR fixes the issue by avoiding the Chocolatey-generated wrapper or shim for the tanzu executable. Instead, it directly uses the tanzu CLI release executable tanzu-cli-windows-*.exe or tanzu command, and updates the install script to ignore creating a wrapper.

Which issue(s) this PR fixes

Fixes #

Describe testing done for PR

  1. The choco pack built in Mac:
cpamuluri@cpamuluriGMD6R tanzu-cli % make choco-package BUILD_VERSION=v1.2.0-rc.0  
docker run --rm \
                -e VERSION=v1.2.0-rc.0 \
                -e SHA_FOR_CHOCO_AMD64= \
                -e SHA_FOR_CHOCO_ARM64= \
                -v /Users/cpamuluri/tkg/tasks/cli_core_main/tanzu-cli:/Users/cpamuluri/tkg/tasks/cli_core_main/tanzu-cli \
                chocolatey/choco:v1.4.0 /Users/cpamuluri/tkg/tasks/cli_core_main/tanzu-cli/hack/choco/build_package.sh
Using SHA_AMD64: d4a715501a10382e903dbb38d18200ca483cf2c32b6bc66c83b49a5e18501e8a
Using SHA_ARM64: ebc49a47dc162d6c1ed1c91db183f8958def7638822e38f4296efdd84ae84b0a
Chocolatey v1.4.0
Attempting to build package from 'tanzu-cli-unstable.nuspec'.
Successfully created package '/Users/cpamuluri/tkg/tasks/cli_core_main/tanzu-cli/hack/choco/_output/choco/tanzu-cli-unstable.1.2.0-rc0.nupkg'

Are you ready for the ultimate experience? Check out Pro / Business!
 https://chocolatey.org/compare

2)Installation after the fix:
After the above build, the files from the tanzu-cli/hack/choco/_output/choco/ (chocolateyInstall.ps1 and tanzu-cli-unstable.1.2.0-rc0.nupkg) copied to windows AMD system, then installed the choco package:
choco install -s=/Users/chan/Downloads tanzu-cli-unstabl --pre --force
image

3)The spinner issue is tested in Power shell and Command prompt, its working fine:
image
image

Release note

The plugin installation spinner termination issue on Windows has been fixed.

Additional information

Special notes for your reviewer

Copy link
Contributor

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just update the PR description please?

LGTM!
I tested it on both Windows AMD64 and Windows ARM64.

@marckhouzam marckhouzam added the kind/bug PR/issue related to a bug label Feb 2, 2024
@marckhouzam marckhouzam added this to the v1.2.0 milestone Feb 2, 2024
The fix updates the chocolatey installation script
to ignore creating wrapper to the tanzu release exe file
instead it uses the tanzu release exe for the tanzu command.
@chandrareddyp chandrareddyp force-pushed the bugfix/spinner-choco-install branch from 5da187a to 58aa467 Compare February 2, 2024 15:59
@chandrareddyp chandrareddyp merged commit 5a30a1a into vmware-tanzu:main Feb 2, 2024
7 checks passed
mpanchajanya pushed a commit that referenced this pull request Feb 7, 2024
The fix updates the chocolatey installation script
to ignore creating wrapper to the tanzu release exe file
instead it uses the tanzu release exe for the tanzu command.

(cherry picked from commit 5a30a1a)
mpanchajanya pushed a commit that referenced this pull request Feb 7, 2024
The fix updates the chocolatey installation script
to ignore creating wrapper to the tanzu release exe file
instead it uses the tanzu release exe for the tanzu command.

(cherry picked from commit 5a30a1a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-not-required kind/bug PR/issue related to a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants