2019-10-17 02:57:45 +00:00
|
|
|
#!/usr/bin/env powershell
|
|
|
|
|
|
|
|
#Requires -Version 5
|
2020-02-11 23:24:27 +00:00
|
|
|
# https://stackoverflow.com/questions/9948517
|
2020-02-13 20:42:41 +00:00
|
|
|
# TODO: Set-StrictMode -Version Latest
|
2020-02-11 23:24:27 +00:00
|
|
|
$PSDefaultParameterValues['*:ErrorAction']='Stop'
|
2019-11-12 20:47:40 +00:00
|
|
|
$ErrorActionPreference = 'Stop'
|
2019-10-17 02:57:45 +00:00
|
|
|
$env:HAB_ORIGIN = 'ci'
|
2019-10-21 21:46:04 +00:00
|
|
|
$env:CHEF_LICENSE = 'accept-no-persist'
|
2019-10-21 23:16:37 +00:00
|
|
|
$env:HAB_LICENSE = 'accept-no-persist'
|
2019-10-17 02:57:45 +00:00
|
|
|
$Plan = 'inspec'
|
|
|
|
|
|
|
|
Write-Host "--- system details"
|
|
|
|
$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
|
|
|
|
Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize
|
|
|
|
|
|
|
|
Write-Host "--- Installing the version of Habitat required"
|
2021-11-11 18:03:42 +00:00
|
|
|
try {
|
|
|
|
hab --version
|
|
|
|
}
|
|
|
|
catch {
|
|
|
|
Set-ExecutionPolicy Bypass -Scope Process -Force
|
|
|
|
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/habitat-sh/habitat/main/components/hab/install.ps1'))
|
|
|
|
}
|
|
|
|
finally {
|
|
|
|
Write-Host ":habicat: I think I have the version I need to build."
|
2019-11-06 22:20:27 +00:00
|
|
|
}
|
|
|
|
|
2019-10-17 02:57:45 +00:00
|
|
|
|
|
|
|
Write-Host "--- Generating fake origin key"
|
|
|
|
hab origin key generate $env:HAB_ORIGIN
|
|
|
|
|
|
|
|
Write-Host "--- Building $Plan"
|
|
|
|
$project_root = "$(git rev-parse --show-toplevel)"
|
|
|
|
Set-Location $project_root
|
|
|
|
|
2019-11-06 22:20:27 +00:00
|
|
|
$env:DO_CHECK=$true; hab pkg build .
|
2019-10-17 02:57:45 +00:00
|
|
|
|
2019-10-22 19:23:31 +00:00
|
|
|
. $project_root/results/last_build.ps1
|
2019-10-17 02:57:45 +00:00
|
|
|
|
2019-10-22 23:17:06 +00:00
|
|
|
Write-Host "--- Installing $pkg_ident/$pkg_artifact"
|
2019-11-06 22:20:27 +00:00
|
|
|
hab pkg install -b $project_root/results/$pkg_artifact
|
2019-11-12 20:47:40 +00:00
|
|
|
|
|
|
|
Write-Host "--- Downloading Ruby + DevKit"
|
2020-08-13 20:47:59 +00:00
|
|
|
aws s3 cp s3://core-buildkite-cache-chef-prod/rubyinstaller-devkit-2.6.6-1-x64.exe c:/rubyinstaller-devkit-2.6.6-1-x64.exe
|
2019-11-12 20:47:40 +00:00
|
|
|
|
|
|
|
Write-Host "--- Installing Ruby + DevKit"
|
2020-08-13 20:47:59 +00:00
|
|
|
Start-Process c:\rubyinstaller-devkit-2.6.6-1-x64.exe -ArgumentList '/verysilent /dir=C:\\ruby26' -Wait
|
2019-11-12 20:47:40 +00:00
|
|
|
|
|
|
|
Write-Host "--- Cleaning up installation"
|
2020-08-13 20:47:59 +00:00
|
|
|
Remove-Item c:\rubyinstaller-devkit-2.6.6-1-x64.exe -Force
|
2019-11-12 20:47:40 +00:00
|
|
|
|
|
|
|
$Env:Path += ";C:\ruby26\bin;C:\hab\bin"
|
2019-10-17 02:57:45 +00:00
|
|
|
|
|
|
|
Write-Host "+++ Testing $Plan"
|
2019-11-06 22:31:47 +00:00
|
|
|
|
2019-10-17 02:57:45 +00:00
|
|
|
Push-Location $project_root/test/artifact
|
|
|
|
rake
|
2019-12-18 20:12:05 +00:00
|
|
|
If ($lastexitcode -ne 0) { Exit $lastexitcode }
|