-
Notifications
You must be signed in to change notification settings - Fork 904
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
(#1092) Ensure chocolateyBeforeModify.ps1 is run for dependencies #3051
Conversation
9abae8a
to
4c097f7
Compare
This addition is necessary, as many occasions may arise where installing one package involves updating an already-installed dependency. In these cases we should still be running a beforeModify script if it's present, and this facilitates that.
663211a
to
dde8edf
Compare
dde8edf
to
4531342
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few questions, nothing that necessarily requires changes though.
...denciesbeforemodify/hasdependencywithbeforemodify/1.0.0/hasdependencywithbeforemodify.nuspec
Show resolved
Hide resolved
...denciesbeforemodify/hasdependencywithbeforemodify/1.0.0/hasdependencywithbeforemodify.nuspec
Show resolved
Hide resolved
...denciesbeforemodify/hasdependencywithbeforemodify/2.0.0/hasdependencywithbeforemodify.nuspec
Show resolved
Hide resolved
@vexx32 for the tests that you are going to add to this, do we need to add any additional tests for hook packages to ensure that they continue to work as expected, or do the current tests cover the changes that you are making in this PR? |
I'll double check the existing tests for that, but I suspect we'll want to add an extra test for that to make sure they work as expected. EDIT: Yeah, I think we're mostly good, but I will add the hooks package into the test and add some checks for the pre-beforeModify hook to make sure it's running each time. |
Previously we only ran backups and beforeModify scripts on the target package(s) and not their dependencies. This change should ensure we are _always_ running backups on any existing packages from a NuGet source before we try to modify them in any way. Additionally, this should ensure we can run the beforeModify scripts for ALL dependencies of the target package(s).
This test added ensures that when we are upgrading a package, both its own and any dependencies' beforeModify are run so that we can properly update dependencies which might need to shut down a long-running service before being upgraded.
4531342
to
49cc8d7
Compare
@gep13 Alright, I think the tests I've added are up to scratch now, we should be good to review this as-is. 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
The failing Ubuntu build here is an issue with NuGet Restore, and nothing to do with the changes in this PR. |
@vexx32 thank you very much for getting this done! |
This migration path hasnt been supported or used since pre-1.0 versions of Chocolatey and is dead code. Removing this now to simplify the install process somewhat and get the old code out of the way as it's not used at all.
Rewrite of the Get-ChocolateyPath into C# cmdlet, and associated changes to helper methods.
Rewrite of the Get-ChocolateyPath into C# cmdlet, and associated changes to helper methods.
Rewrite of the Get-ChocolateyPath into C# cmdlet, and associated changes to helper methods.
To ensure behaviour works as expected
Test all the things!
Description Of Changes
choco install
operation.Motivation and Context
This improves the overall soundness of our package operations, and fixes an issue where updating Chocolatey licensed packages can trip over the chocolatey-agent package if it ends up being updated during processing of dependencies (for instance, by updating one of its dependencies outside of its currently permitted version range, while a newer agent package is available that will work with the newer dependency version.
Testing
chocolateygui.extension
package. With this change, the upgrade should correctly run the chocolatey-agent beforeModify script and succeed smoothly.There are a couple unit tests I'd still like to add, but the currently-added ones cover the main priority here at the moment.
Operating Systems Testing
Win10, Win11
Change Types Made
Change Checklist
Related Issue
Fixes #1092