summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBapu L <bapu.labade@progress.com>2022-08-24 14:09:35 +0530
committerBapu L <bapu.labade@progress.com>2022-08-24 16:46:40 +0530
commit11b2ee91f7a2f9affb2ae311b32bcd6725317f64 (patch)
tree1c05b433aeb1c4147ae0fe59de22caa9f6ce331c
parent5559293d956a6dd76d1027865314b23713b6d9b1 (diff)
downloadchef-11b2ee91f7a2f9affb2ae311b32bcd6725317f64.tar.gz
fix git client windows failures
Signed-off-by: Bapu L <bapu.labade@progress.com>
-rw-r--r--cspell.json4
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/windows.rb48
2 files changed, 52 insertions, 0 deletions
diff --git a/cspell.json b/cspell.json
index baafe6cbeb..a1ea1e2cf5 100644
--- a/cspell.json
+++ b/cspell.json
@@ -388,6 +388,7 @@
"fmri",
"fname",
"foorb",
+ "FORCECLOSEAPPLICATIONS",
"FORCEMINIMIZE",
"FORCEOFFFEEDBACK",
"FORCEONFEEDBACK",
@@ -974,6 +975,7 @@
"PRINTPROCESSOR",
"PRINTQ",
"PROCNUM",
+ "processname",
"procs",
"progname",
"PROMPTSTRUCT",
@@ -1185,6 +1187,7 @@
"signedheaderauth",
"SIGQUIT",
"SIGUSR",
+ "silentlycontinue",
"SINGLELINE",
"singleline",
"Singleuser",
@@ -1339,6 +1342,7 @@
"unformatter",
"unhold",
"unignored",
+ "unins",
"uninst",
"unintuitive",
"unixy",
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb b/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
index 454eb04aaf..0f483467ec 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
@@ -13,6 +13,54 @@ chef_sleep "2"
execute "dir"
+execute "Print git version" do
+ command "git --version & git --exec-path"
+ live_stream true
+end
+
+# FIXME Uninstall git using powershell
+# this is a temporary band-aid due to the fallback git version in
+# https://github.com/sous-chefs/git defaulting to an older version of git
+# than will be installed on the current image this runs in for GitHub Actions
+powershell_script "uninstall_git" do
+ code <<-EOH
+ $possibleInstalledPaths = @("C:/Program Files/Git/", "C:/Program Files (x64)/Git/", "c:/git/")
+ $foundAnInstallation = $false
+ ### For all places where Git "could" be.
+ foreach ($installPath in $possibleInstalledPaths)
+ {
+ ### If the path where Git could exist
+ if (Test-Path($installPath))
+ {
+ ## Some Git stuff might be running.. kill them.
+ Stop-Process -processname Bash -erroraction 'silentlycontinue'
+ Stop-Process -processname Putty* -erroraction 'silentlycontinue'
+ $foundAnInstallation = $true
+ Write-Host "Removing Git from " $installPath
+ ### Find if there's an uninstaller in the folder.
+ $uninstallers = Get-ChildItem $installPath"unins*.exe"
+ ### In reality, there should only be just one that matches.
+ foreach ($uninstaller in $uninstallers)
+ {
+ ### Invoke the uninstaller.
+ $uninstallerCommandLineOptions = "/SP- /VERYSILENT /SUPPRESSMSGBOXES /FORCECLOSEAPPLICATIONS"
+ Start-Process -Wait -FilePath $uninstaller -ArgumentList $uninstallerCommandLineOptions
+ }
+ ### Remove the folder if it didn't clean up properly.
+ if (Test-Path($installPath))
+ {
+ Remove-Item -Recurse -Force $installPath
+ }
+ }
+ }
+ if (!($foundAnInstallation))
+ {
+ Write-Host "No git installation found. Nothing to uninstall"
+ }
+ EOH
+ live_stream true
+end
+
powershell_script "sleep 1 second" do
code "Start-Sleep -s 1"
live_stream true