-
Notifications
You must be signed in to change notification settings - Fork 385
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
(git.install) Terminate gpg-agent when indirectly upgrading #1945
(git.install) Terminate gpg-agent when indirectly upgrading #1945
Conversation
…and Install scripts, as workaround for chocolatey/choco#1092
✅ Package verification completed without issues. PR is now pending human review |
…fixes and optimizations * Use -like comparison operator instead of -ilike * Update Install-ChocolateyInstallPackage's SoftwareName parameter to currently used name to correctly detect install location * Remove return statement from installLocation check. This prevented code execution beyond it (notably failing to honor the NoCredentialManager package parameter), and is not a critical failure * Refactor stop process helper functions to a parameterized implementation * Optimize process lookup to a single Get-Process invocation per process search * Implement process filtering based on detected install location instead of implied Git directory
New commit pushed with changes to address feedback and implement some additional fixes. Additional tests ran with a newly built version: Enhancement:
|
✅ Package verification completed without issues. PR is now pending human review |
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
@brogers5 your changes have been merged, thanks for your contribution 👍 |
Description
This changeset implements a package-level workaround for chocolatey/choco#1092, as originally discussed in #1924.
Fixes #1938.
Motivation and Context
When upgrading
git.install
indirectly (via eitherchoco upgrade git
orchoco upgrade all
, which will alphabetically iterate throughgit
first),choco
will fail to executechocolateyBeforeModify.ps1
of any package dependencies being installed. In the context ofgit.install
, this contains commands to stop any running instances ofgpg-agent.exe
, which may run as a background process when commit signing is enabled. Commit signing is a commonly enabled feature to help certify the authenticity of a given commit's author.While this would ideally be fixed upstream in
choco
, there is currently no ETA on when a fix would roll out. As a stopgap solution, wrapping this functionality within a new function defined inhelpers.ps1
, and calling the function from bothchocolateyBeforeModify.ps1
andchocolateyInstall.ps1
. The former is required to accommodate uninstall commands, while the latter should cover any upgrade scenario, whether invoked directly (viachoco upgrade git.install
) or indirectly.How Has this Been Tested?
Setup
git.install
'stools
directory, as they are not committed to this repository.choco pack
within bothgit
andgit.install
directories of local repository to create test packages with proposed changeset.git
andgit.install
packages withchoco install git --version=2.36.1 --params "/GitAndUnixToolsOnPath"
.gpg --full-generate-key
. Default options were used, with arbitrary user ID and passphrase.gpg-agent.exe
withgpgconf --launch gpg-agent
.gpg-agent.exe
has launched.Test Cases
Indirect Package Upgrade via Metapackage
choco upgrade git --source="."
(assuming packages are in current directory).gpg-agent.exe
is successfully closed, and the upgrade command completes without errors.Direct Package Upgrade
gpg-agent.exe
withgpgconf --launch gpg-agent
.choco upgrade git.install --source="." --force
(assuming package is in current directory).gpg-agent.exe
is successfully closed, and the upgrade command completes without errors.Uninstall
gpg-agent.exe
withgpgconf --launch gpg-agent
.choco uninstall git
.git.install
package as well.gpg-agent.exe
is successfully closed, and the uninstall command completes without errors.Screenshot (if appropriate, usually isn't needed):
N/A
Types of changes
Checklist: