diff options
author | Bryan McLellan <btm@loftninjas.org> | 2020-05-13 10:55:15 -0400 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2020-05-13 15:36:37 -0400 |
commit | df065cfc02f93872fc2e37263fa1c408eac471ca (patch) | |
tree | 970e643ed9b9143384607911dd74543ea695a68d /scripts | |
parent | 2e58fd6d0b95003b1b5b2722373ca5cde835dcb7 (diff) | |
download | chef-df065cfc02f93872fc2e37263fa1c408eac471ca.tar.gz |
Deduplicate the bk windows scripts
Signed-off-by: Bryan McLellan <btm@loftninjas.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/bk_tests/bk_run_choco.ps1 | 23 | ||||
-rw-r--r-- | scripts/bk_tests/bk_win_integration.ps1 | 23 | ||||
-rw-r--r-- | scripts/bk_tests/bk_win_prep.ps1 | 20 | ||||
-rw-r--r-- | scripts/bk_tests/bk_win_unit.ps1 | 23 |
4 files changed, 29 insertions, 60 deletions
diff --git a/scripts/bk_tests/bk_run_choco.ps1 b/scripts/bk_tests/bk_run_choco.ps1 index 37a8c2949d..49f9186701 100644 --- a/scripts/bk_tests/bk_run_choco.ps1 +++ b/scripts/bk_tests/bk_run_choco.ps1 @@ -1,26 +1,9 @@ -echo "--- system details" -$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture' -Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize +$CurrentDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent +$PrepScript = Join-Path $CurrentDirectory "bk_win_prep.ps1" +Invoke-Expression $PrepScript choco --version -echo "--- update bundler" - -ruby -v -if (-not $?) { throw "Can't run Ruby. Is it installed?" } - -$env:BUNDLER_VERSION=$(findstr bundler omnibus_overrides.rb | %{ $_.split(" ")[3] }) -$env:BUNDLER_VERSION=($env:BUNDLER_VERSION -replace '"', "") -echo $env:BUNDLER_VERSION - -gem install bundler -v $env:BUNDLER_VERSION --force --no-document --quiet -if (-not $?) { throw "Unable to update Bundler" } -bundle --version - -echo "--- bundle install" -bundle install --jobs=3 --retry=3 --without omnibus_package docgen chefstyle -if (-not $?) { throw "Unable to install gem dependencies" } - echo "+++ bundle exec rspec chocolatey_package_spec" bundle exec rspec spec/functional/resource/chocolatey_package_spec.rb if (-not $?) { throw "Chef chocolatey functional tests failing." } diff --git a/scripts/bk_tests/bk_win_integration.ps1 b/scripts/bk_tests/bk_win_integration.ps1 index 0534a24302..6337e460b7 100644 --- a/scripts/bk_tests/bk_win_integration.ps1 +++ b/scripts/bk_tests/bk_win_integration.ps1 @@ -1,29 +1,12 @@ -echo "--- system details" -$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture' -Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize +$CurrentDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent +$PrepScript = Join-Path $CurrentDirectory "bk_win_prep.ps1" +Invoke-Expression $PrepScript # Set-Item -Path Env:Path -Value ($Env:Path + ";C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin") $Env:Path="C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\ruby26\bin;C:\ci-studio-common\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Users\ContainerAdministrator\AppData\Local\Microsoft\WindowsApps;C:\Go\bin;C:\Users\ContainerAdministrator\go\bin" winrm quickconfig -q -echo "--- update bundler" - -ruby -v -if (-not $?) { throw "Can't run Ruby. Is it installed?" } - -$env:BUNDLER_VERSION=$(findstr bundler omnibus_overrides.rb | %{ $_.split(" ")[3] }) -$env:BUNDLER_VERSION=($env:BUNDLER_VERSION -replace '"', "") -echo $env:BUNDLER_VERSION - -gem install bundler -v $env:BUNDLER_VERSION --force --no-document --quiet -if (-not $?) { throw "Unable to update Bundler" } -bundle --version - -echo "--- bundle install" -bundle install --jobs=3 --retry=3 --without omnibus_package docgen chefstyle -if (-not $?) { throw "Unable to install gem dependencies" } - echo "+++ bundle exec rake spec:integration" bundle exec rake spec:integration if (-not $?) { throw "Chef integration specs failing." } diff --git a/scripts/bk_tests/bk_win_prep.ps1 b/scripts/bk_tests/bk_win_prep.ps1 new file mode 100644 index 0000000000..1d7199916b --- /dev/null +++ b/scripts/bk_tests/bk_win_prep.ps1 @@ -0,0 +1,20 @@ +echo "--- system details" +$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture' +Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize + +echo "--- update bundler" + +ruby -v +if (-not $?) { throw "Can't run Ruby. Is it installed?" } + +$env:BUNDLER_VERSION=$(findstr bundler omnibus_overrides.rb | %{ $_.split(" ")[3] }) +$env:BUNDLER_VERSION=($env:BUNDLER_VERSION -replace '"', "") +echo $env:BUNDLER_VERSION + +gem install bundler -v $env:BUNDLER_VERSION --force --no-document --quiet +if (-not $?) { throw "Unable to update Bundler" } +bundle --version + +echo "--- bundle install" +bundle install --jobs=3 --retry=3 --without omnibus_package docgen chefstyle +if (-not $?) { throw "Unable to install gem dependencies" } diff --git a/scripts/bk_tests/bk_win_unit.ps1 b/scripts/bk_tests/bk_win_unit.ps1 index 4d56acf532..f1f28ade05 100644 --- a/scripts/bk_tests/bk_win_unit.ps1 +++ b/scripts/bk_tests/bk_win_unit.ps1 @@ -1,23 +1,6 @@ -echo "--- system details" -$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture' -Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize - -echo "--- update bundler" - -ruby -v -if (-not $?) { throw "Can't run Ruby. Is it installed?" } - -$env:BUNDLER_VERSION=$(findstr bundler omnibus_overrides.rb | %{ $_.split(" ")[3] }) -$env:BUNDLER_VERSION=($env:BUNDLER_VERSION -replace '"', "") -echo $env:BUNDLER_VERSION - -gem install bundler -v $env:BUNDLER_VERSION --force --no-document --quiet -if (-not $?) { throw "Unable to update Bundler" } -bundle --version - -echo "--- bundle install" -bundle install --jobs=3 --retry=3 --without omnibus_package docgen chefstyle -if (-not $?) { throw "Unable to install gem dependencies" } +$CurrentDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent +$PrepScript = Join-Path $CurrentDirectory "bk_win_prep.ps1" +Invoke-Expression $PrepScript echo "+++ bundle exec rake" bundle exec rake spec:unit |