summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCrae <john.mccrae@progress.com>2022-10-30 10:23:22 +0600
committerJohn McCrae <john.mccrae@progress.com>2022-10-30 10:23:22 +0600
commitcc1b5c976afa247fd384e45fc9ec902dc157cfb2 (patch)
tree9744872e0d6d06d5fe2086252ef909e44854ba45
parenteaec32d0f1231e7ae608be90caffaf30ec8c68c8 (diff)
downloadchef-cc1b5c976afa247fd384e45fc9ec902dc157cfb2.tar.gz
Where is Git installed again? AND added an ErrorActionPreference
Signed-off-by: John McCrae <john.mccrae@progress.com>
-rw-r--r--habitat/plan.ps148
1 files changed, 27 insertions, 21 deletions
diff --git a/habitat/plan.ps1 b/habitat/plan.ps1
index 76c76a4ccf..10b9ca48f8 100644
--- a/habitat/plan.ps1
+++ b/habitat/plan.ps1
@@ -1,3 +1,4 @@
+$ErrorActionPreference = 'Continue'
$pkg_name="chef-infra-client"
$pkg_origin="chef"
$pkg_version=(Get-Content $PLAN_CONTEXT/../VERSION)
@@ -46,27 +47,32 @@ function Invoke-Download() {
$git_path = "c:\\Program Files\\Git\\bin"
$env:Path = $git_path + ";" + [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
try {
- Push-Location (Resolve-Path "$PLAN_CONTEXT/../").Path
- # Write-Output "`n *** Installing Choco *** `n"
- # Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
- # choco install gh -y
- # choco install git -y
- $env:Path = $git_path + ";" + [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
- $full_git_path = $($git_path + "\git.exe")
- Write-Ouput "Is Git REALLY Installed? "
- Test-Path -Path $full_git_path
- # Get-Command "Git"
- Write-Output "Hab source path is : ${HAB_CACHE_SRC_PATH}`n"
- Write-Output "Package Filename is : ${pkg_filename}"
- # [System.Diagnostics.Process]::Start("c:\\Program Files\\Git\\cmd\\git.exe archive --format=zip --output=${HAB_CACHE_SRC_PATH}\\${pkg_filename} HEAD")
- Write-Output "Now archiving the repo"
- [System.Diagnostics.Process]::Start("$full_git_path archive --format=zip --output=${HAB_CACHE_SRC_PATH}\\${pkg_filename} HEAD --verbose")
- # Invoke-Expression -Command "$full_git_path archive --format=zip --output=${HAB_CACHE_SRC_PATH}\\${pkg_filename} HEAD --verbose"
- Write-Output "Zipping the Repo is finished"
- Start-Sleep -Seconds 30
- Write-Output " *** Finished Creating the Archive *** `n"
- # getting an error about the archive being in use, adding the sleep to let other handles on the file finish.
- if (-not $?) { throw "unable to create archive of source" }
+ $output = Get-ChildItem -Path C:\ -File "git.exe" -Recurse -ErrorAction SilentlyContinue
+ Write-Output "Here are the installed instances of Git"
+ foreach($path in $output){
+ Write-Output $path
+ }
+ # Push-Location (Resolve-Path "$PLAN_CONTEXT/../").Path
+ # # Write-Output "`n *** Installing Choco *** `n"
+ # # Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
+ # # choco install gh -y
+ # # choco install git -y
+ # $env:Path = $git_path + ";" + [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
+ # $full_git_path = $($git_path + "\git.exe")
+ # Write-Ouput "Is Git REALLY Installed? "
+ # Test-Path -Path $full_git_path
+ # # Get-Command "Git"
+ # Write-Output "Hab source path is : ${HAB_CACHE_SRC_PATH}`n"
+ # Write-Output "Package Filename is : ${pkg_filename}"
+ # # [System.Diagnostics.Process]::Start("c:\\Program Files\\Git\\cmd\\git.exe archive --format=zip --output=${HAB_CACHE_SRC_PATH}\\${pkg_filename} HEAD")
+ # Write-Output "Now archiving the repo"
+ # [System.Diagnostics.Process]::Start("$full_git_path archive --format=zip --output=${HAB_CACHE_SRC_PATH}\\${pkg_filename} HEAD --verbose")
+ # # Invoke-Expression -Command "$full_git_path archive --format=zip --output=${HAB_CACHE_SRC_PATH}\\${pkg_filename} HEAD --verbose"
+ # Write-Output "Zipping the Repo is finished"
+ # Start-Sleep -Seconds 30
+ # Write-Output " *** Finished Creating the Archive *** `n"
+ # # getting an error about the archive being in use, adding the sleep to let other handles on the file finish.
+ # if (-not $?) { throw "unable to create archive of source" }
catch{
Write-Output "Plan.ps1 threw an error in Invoke-Download - An error occurred:"
Write-Output $_