Files
runner-images/images/windows/scripts/build/Install-CloudFoundryCli.ps1
Pavel Iakovenko 7eede67cd0 Validate authenticode signature using the certificate Subject (#12474)
* Use cerificate subject to verify authenticode signature

* Use function instead of script variables

* Switch all places to using Get-MicrosoftPublisher

* Remove SignatureThumbprint

* Use common subject for the Edge driver
2025-06-30 19:33:57 -06:00

26 lines
1023 B
PowerShell

################################################################################
## File: Install-CloudFoundryCli.ps1
## Desc: Install Cloud Foundry CLI
################################################################################
# Download the latest cf cli exe
$cloudFoundryCliUrl = "https://packages.cloudfoundry.org/stable?release=windows64-exe&source=github"
$cloudFoundryArchPath = Invoke-DownloadWithRetry $cloudFoundryCliUrl
# Create directory for cf cli
$cloudFoundryCliPath = "C:\cf-cli"
New-Item -Path $cloudFoundryCliPath -ItemType Directory -Force
# Extract the zip archive
Write-Host "Extracting cf cli..."
Expand-7ZipArchive -Path $cloudFoundryArchPath -DestinationPath $cloudFoundryCliPath
# Add cf to path
Add-MachinePathItem $cloudFoundryCliPath
# Validate cf signature
Test-FileSignature -Path "$cloudFoundryCliPath\cf.exe" -ExpectedSubject 'CN="LF Projects, LLC", O="LF Projects, LLC", L=Wilmington, S=Delaware, C=US'
Invoke-PesterTests -TestFile "CLI.Tools" -TestName "CloudFoundry CLI"