inspec/omnibus/omnibus-test.ps1

37 lines
1.5 KiB
PowerShell
Raw Normal View History

# Stop script execution when a non-terminating error occurs
$ErrorActionPreference = "Stop"
$channel = "$Env:CHANNEL"
If ([string]::IsNullOrEmpty($channel)) { $channel = "unstable" }
$product = "$Env:PRODUCT"
If ([string]::IsNullOrEmpty($product)) { $product = "inspec" }
$version = "$Env:VERSION"
If ([string]::IsNullOrEmpty($version)) { $version = "latest" }
Write-Output "--- Installing $channel $product $version"
$package_file = $(C:\opscode\omnibus-toolchain\bin\install-omnibus-product.ps1 -Product "$product" -Channel "$channel" -Version "$version" | Select-Object -Last 1)
Write-Output "--- Verifying omnibus package is signed"
C:\opscode\omnibus-toolchain\bin\check-omnibus-package-signed.ps1 "$package_file"
Write-Output "--- Running verification for $channel $product $version"
# reload Env:PATH to ensure it gets any changes that the install made (e.g. C:\opscode\inspec\bin\ )
$Env:PATH = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
# Set GEM_HOME and GEM_PATH to verify our appbundle inspec shim is correctly
# removing them from the environment while launching from our embedded ruby.
$Env:GEM_HOME = "C:\SHOULD_NOT_EXIST"
$Env:GEM_PATH = "C:\SHOULD_NOT_EXIST"
inspec version
If ($lastexitcode -ne 0) { Exit $lastexitcode }
inspec shell -c platform.family
If ($lastexitcode -ne 0) { Exit $lastexitcode }
inspec plugin list
If ($lastexitcode -ne 0) { Exit $lastexitcode }