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

(#3327) Improves UX of Chocolatey Install without 4.8 #3329

Merged
merged 3 commits into from
Apr 24, 2024

Conversation

JPRuskin
Copy link
Member

@JPRuskin JPRuskin commented Sep 20, 2023

Description Of Changes

This commit introduces the idea that the dotnet installation needing a reboot should not immediately halt the Chocolatey installation, but instead proceed as far as possible - then prompt for a reboot without throwing.

Motivation and Context

The install script currently throws after dotnet 4.8 is installed, which requires the user reboot and then re-run the install script. This, at least, reduces the need for an additional step post-reboot.

Testing

  1. Build or finagle Chocolatey package with updated setup functions
    I downloaded the Chocolatey 2.2.2 package and used 7zip to overwrite chocolateysetup.psm1 with my changes.
  2. Download Install.ps1
  3. Run Install.ps1 -ChocolateyDownloadUrl ~\Path\to\Choco.nupkg (after execution policy / unblocking files)

Operating Systems Testing

  • Windows 2019 (without dotnet 4.8 installed)
    image
  • Windows 10 sandbox (with dotnet 4.8 available)
    image
    (no change to output)
  • Windows Server 2012 (with dotnet 4.8 available, and PowerShell v3)
    image
  • Windows Server 2012 (without dotnet 4.8, and PowerShell v3)
    image

Change Types Made

  • [ ] Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • [ ] Breaking change (fix or feature that could cause existing functionality to change).
  • [ ] Documentation changes.
  • PowerShell code changes.

Change Checklist

  • [?] Requires a change to the documentation.
    I am unsure if there is any reference to this behaviour in our documentation.
  • Documentation has been updated.
  • [ ] Tests to cover my changes, have been added.
  • [ ] All new and existing tests passed?
  • PowerShell code changes: PowerShell v2 compatibility checked visually but not by running it on an actual PSv2 system

Related Issue

Fixes #3327

@pauby
Copy link
Member

pauby commented Sep 22, 2023

PowerShell code changes: PowerShell v2 compatibility checked?

This needs to be checked. We still support PowerShell v2.

@JPRuskin
Copy link
Member Author

JPRuskin commented Sep 25, 2023

PowerShell code changes: PowerShell v2 compatibility checked?

This needs to be checked. We still support PowerShell v2.

I see nothing in my changes that is incompatible, to my knowledge, but I haven't run it in PS v2.

@pauby
Copy link
Member

pauby commented Sep 25, 2023

I see nothing in my changes that is incompatible, to my knowledge, but I haven't run it in PS v2.

As belt and braces, can you please run it in PS v2?

Can you also ensure the script says 'Chocolatey CLI' and not 'Chocolatey'?

@JPRuskin
Copy link
Member Author

JPRuskin commented Sep 27, 2023

Can you also ensure the script says 'Chocolatey CLI' and not 'Chocolatey'?

Just to be clear, do you mean updating all instances of "Chocolatey" to "Chocolatey CLI" across the installation, or just bits that I've touched for this PR?

Examples of "bits I've touched" (in yellow), all instances that are likely to want updating if we're going to make it consistent (orange), things unlikely in my opinion to want updating (red):

image

(just noticed that strictly that second to last orange one I did add, but I based that on an existing message - would update them both if that were needed)

@JPRuskin
Copy link
Member Author

JPRuskin commented Nov 7, 2023

Can you also ensure the script says 'Chocolatey CLI' and not 'Chocolatey'?

@pauby Just chasing this up, as I'd like to try and get this merged before January.

@pauby
Copy link
Member

pauby commented Nov 9, 2023

Can you also ensure the script says 'Chocolatey CLI' and not 'Chocolatey'?

@pauby Just chasing this up, as I'd like to try and get this merged before January.

For consistency it would be good to change all of the Chocolatey mentions that mean Chocolatey CLI to Chocolatey CLI.

@JPRuskin JPRuskin force-pushed the dotnetInstallChange branch from 6b45623 to 296b438 Compare February 22, 2024 12:18
@JPRuskin
Copy link
Member Author

JPRuskin commented Feb 26, 2024

So, having an unexpected issue running this on the Windows 2012 (with PowerShell 3, no 4.8) system I have access to:
image

image

Pretty neat!

That said, it does recover after the reboot.
image

I've not seen that issue before, even on other non-4.8 having systems. Any thoughts, @gep13? We thought it would be safe to run /version, but it seems not. 4.5.2 seems to be present on this system.

I still like this change, and would prefer to not run choco.exe /version before the reboot (on a reboot-needing run) if this is happening, rather than give up on it.

@JPRuskin JPRuskin force-pushed the dotnetInstallChange branch from 296b438 to 960360f Compare February 29, 2024 18:10
@pauby
Copy link
Member

pauby commented Mar 14, 2024

I wanted to highlight this issue here, which ist not fixed by this issue, but is related.

@pauby
Copy link
Member

pauby commented Mar 14, 2024

I still like this change, and would prefer to not run choco.exe /version before the reboot (on a reboot-needing run) if this is happening, rather than give up on it.

Could we detect Server 2012, put some words in a different colour (to highlight it - maybe Write-Warning) to say you'll get an error here, ignore it, reboot as normal and everything will be fine?

@JPRuskin
Copy link
Member Author

Could we detect Server 2012, put some words in a different colour (to highlight it - maybe Write-Warning) to say you'll get an error here, ignore it, reboot as normal and everything will be fine?

We could indeed! I'll give that a go, and we can see if we think it's enough.

@JPRuskin JPRuskin self-assigned this Apr 18, 2024
@JPRuskin JPRuskin force-pushed the dotnetInstallChange branch from 960360f to 86b3a74 Compare April 23, 2024 16:57
@JPRuskin JPRuskin requested a review from gep13 April 23, 2024 17:50
@JPRuskin JPRuskin force-pushed the dotnetInstallChange branch from 86b3a74 to c0e703b Compare April 24, 2024 07:47
This commit introduces the idea that the dotnet installation needing a
reboot should not immediately halt the Chocolatey installation, but
instead proceed as far as possible - then prompt for a reboot.
Won't run in environments where DotNet 4.8 has been installed where
running in PS<=3, due to the issues found when testing in those
environments.

Also improves the handling of errors, as previously we were never
"reaching" an error due to the way Choco CLI's streams and exit codes
work out.
@gep13 gep13 force-pushed the dotnetInstallChange branch from c0e703b to 547dab9 Compare April 24, 2024 10:11
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

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

LGTM!

@gep13
Copy link
Member

gep13 commented Apr 24, 2024

@JPRuskin I took the liberty of modifying your commit messages slightly (they were overrunning the standard that we use for commit messages) but other than that, this LGTM, and I will merge once the CI builds complete.

@gep13 gep13 merged commit 983627c into chocolatey:develop Apr 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rerunning Install Script after reboot should not be necessary
3 participants