summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobb Kidd <robb@thekidds.org>2020-04-28 13:05:28 -0400
committerRobb Kidd <robb@thekidds.org>2020-04-28 13:53:54 -0400
commitf0b399f34c2573d6a0666b987c7d22cdaf667f8c (patch)
tree29a5941d7fc4c957bde818cb896a952ce61e98b4
parentc3255ac9e62f71f834760c39c69cef50a2273922 (diff)
downloadchef-f0b399f34c2573d6a0666b987c7d22cdaf667f8c.tar.gz
move common windows setup to a single script
Signed-off-by: Robb Kidd <robb@thekidds.org>
-rw-r--r--scripts/bk_tests/bk_run_choco.ps131
-rw-r--r--scripts/bk_tests/bk_win_functional.ps134
-rw-r--r--scripts/bk_tests/bk_win_integration.ps132
-rw-r--r--scripts/bk_tests/bk_win_unit.ps130
-rw-r--r--scripts/bk_tests/win_setup.ps136
5 files changed, 45 insertions, 118 deletions
diff --git a/scripts/bk_tests/bk_run_choco.ps1 b/scripts/bk_tests/bk_run_choco.ps1
index cf84b1feb5..2dacc9283d 100644
--- a/scripts/bk_tests/bk_run_choco.ps1
+++ b/scripts/bk_tests/bk_run_choco.ps1
@@ -1,34 +1,9 @@
-echo "--- system details"
-$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
-Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize
+$BKScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
+& "$BKScriptDir\win_setup.ps1"
+echo "!!! Chocolatey version !!!"
choco --version
-echo "--- update bundler and rubygems"
-
-ruby -v
-if (-not $?) { throw "Can't run Ruby. Is it installed?" }
-
-$env:RUBYGEMS_VERSION=$(findstr rubygems omnibus_overrides.rb | %{ $_.split(" ")[3] })
-$env:BUNDLER_VERSION=$(findstr bundler omnibus_overrides.rb | %{ $_.split(" ")[3] })
-
-$env:RUBYGEMS_VERSION=($env:RUBYGEMS_VERSION -replace '"', "")
-$env:BUNDLER_VERSION=($env:BUNDLER_VERSION -replace '"', "")
-
-echo $env:RUBYGEMS_VERSION
-echo $env:BUNDLER_VERSION
-
-gem update --system $env:RUBYGEMS_VERSION
-if (-not $?) { throw "Unable to update system Rubygems" }
-gem --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_functional.ps1 b/scripts/bk_tests/bk_win_functional.ps1
index 90abfe890f..ce6929801f 100644
--- a/scripts/bk_tests/bk_win_functional.ps1
+++ b/scripts/bk_tests/bk_win_functional.ps1
@@ -71,10 +71,6 @@ Function InstallRuby
Remove-Item $RubyPath -Force -ErrorAction SilentlyContinue
}
-echo "--- system details"
-$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
-Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize
-
# chocolatey functional tests fail so delete the chocolatey binary to avoid triggering them
Remove-Item -Path C:\ProgramData\chocolatey\bin\choco.exe -ErrorAction SilentlyContinue
@@ -86,34 +82,8 @@ InstallRuby
# Set-Item -Path Env:Path -Value to include ruby26
$Env:Path+=";C:\ruby26\bin"
-echo "--- configure winrm"
-
-winrm quickconfig -q
-
-echo "--- update bundler and rubygems"
-
-ruby -v
-if (-not $?) { throw "Can't run Ruby. Is it installed?" }
-
-$env:RUBYGEMS_VERSION=$(findstr rubygems omnibus_overrides.rb | %{ $_.split(" ")[3] })
-$env:BUNDLER_VERSION=$(findstr bundler omnibus_overrides.rb | %{ $_.split(" ")[3] })
-
-$env:RUBYGEMS_VERSION=($env:RUBYGEMS_VERSION -replace '"', "")
-$env:BUNDLER_VERSION=($env:BUNDLER_VERSION -replace '"', "")
-
-echo $env:RUBYGEMS_VERSION
-echo $env:BUNDLER_VERSION
-
-gem update --system $env:RUBYGEMS_VERSION
-if (-not $?) { throw "Unable to update system Rubygems" }
-gem --version
-gem install bundler -v $env:BUNDLER_VERSION --force --no-document --quiet
-if (-not $?) { throw "Unable to update Bundler" }
-bundle --versio
-
-echo "--- bundle install"
-bundle install --jobs=3 --retry=3 --without omnibus_package docgen chefstyle
-if (-not $?) { throw "Unable to install gem dependencies" }
+$BKScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
+& "$BKScriptDir\win_setup.ps1"
echo "+++ bundle exec rake spec:functional"
bundle exec rake spec:functional
diff --git a/scripts/bk_tests/bk_win_integration.ps1 b/scripts/bk_tests/bk_win_integration.ps1
index 88d23802cd..a2652759c1 100644
--- a/scripts/bk_tests/bk_win_integration.ps1
+++ b/scripts/bk_tests/bk_win_integration.ps1
@@ -1,37 +1,9 @@
-echo "--- system details"
-$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
-Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize
+$BKScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
+& "$BKScriptDir\win_setup.ps1"
# 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 and rubygems"
-
-ruby -v
-if (-not $?) { throw "Can't run Ruby. Is it installed?" }
-
-$env:RUBYGEMS_VERSION=$(findstr rubygems omnibus_overrides.rb | %{ $_.split(" ")[3] })
-$env:BUNDLER_VERSION=$(findstr bundler omnibus_overrides.rb | %{ $_.split(" ")[3] })
-
-$env:RUBYGEMS_VERSION=($env:RUBYGEMS_VERSION -replace '"', "")
-$env:BUNDLER_VERSION=($env:BUNDLER_VERSION -replace '"', "")
-
-echo $env:RUBYGEMS_VERSION
-echo $env:BUNDLER_VERSION
-
-gem update --system $env:RUBYGEMS_VERSION
-if (-not $?) { throw "Unable to update system Rubygems" }
-gem --version
-gem install bundler -v $env:BUNDLER_VERSION --force --no-document --quiet
-if (-not $?) { throw "Unable to update Bundler" }
-bundle --versio
-
-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_unit.ps1 b/scripts/bk_tests/bk_win_unit.ps1
index 2ec313fdd0..437cad9e49 100644
--- a/scripts/bk_tests/bk_win_unit.ps1
+++ b/scripts/bk_tests/bk_win_unit.ps1
@@ -1,31 +1,5 @@
-echo "--- system details"
-$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
-Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize
-
-echo "--- update bundler and rubygems"
-
-ruby -v
-if (-not $?) { throw "Can't run Ruby. Is it installed?" }
-
-$env:RUBYGEMS_VERSION=$(findstr rubygems omnibus_overrides.rb | %{ $_.split(" ")[3] })
-$env:BUNDLER_VERSION=$(findstr bundler omnibus_overrides.rb | %{ $_.split(" ")[3] })
-
-$env:RUBYGEMS_VERSION=($env:RUBYGEMS_VERSION -replace '"', "")
-$env:BUNDLER_VERSION=($env:BUNDLER_VERSION -replace '"', "")
-
-echo $env:RUBYGEMS_VERSION
-echo $env:BUNDLER_VERSION
-
-gem update --system $env:RUBYGEMS_VERSION
-if (-not $?) { throw "Unable to update system Rubygems" }
-gem --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" }
+$BKScriptDir = Split-Path $script:MyInvocation.MyCommand.Path
+& "$BKScriptDir\win_setup.ps1"
echo "+++ bundle exec rake"
bundle exec rake spec:unit
diff --git a/scripts/bk_tests/win_setup.ps1 b/scripts/bk_tests/win_setup.ps1
new file mode 100644
index 0000000000..aa47de5fc3
--- /dev/null
+++ b/scripts/bk_tests/win_setup.ps1
@@ -0,0 +1,36 @@
+echo "--- system details"
+$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
+Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize
+
+echo "--- configure winrm"
+winrm quickconfig -q
+
+echo "--- update bundler and rubygems"
+echo "!!! Ruby Version !!!"
+ruby -v
+if (-not $?) { throw "Can't run Ruby. Is it installed?" }
+
+$env:RUBYGEMS_VERSION=$(findstr rubygems omnibus_overrides.rb | %{ $_.split(" ")[3] })
+$env:BUNDLER_VERSION=$(findstr bundler omnibus_overrides.rb | %{ $_.split(" ")[3] })
+
+$env:RUBYGEMS_VERSION=($env:RUBYGEMS_VERSION -replace '"', "")
+$env:BUNDLER_VERSION=($env:BUNDLER_VERSION -replace '"', "")
+
+echo "RubyGems version: $env:RUBYGEMS_VERSION"
+echo "Bundler version: $env:BUNDLER_VERSION"
+
+echo "--- update rubygems"
+gem update --system $env:RUBYGEMS_VERSION
+if (-not $?) { throw "Unable to update system Rubygems" }
+echo "!!! RubyGems version !!!"
+gem --version
+
+echo "--- update bundler"
+gem install bundler -v $env:BUNDLER_VERSION --force --no-document --quiet
+if (-not $?) { throw "Unable to update Bundler" }
+echo "!!! bundler version !!!"
+bundle --version
+
+echo "--- bundle install project dependencies"
+bundle install --jobs=3 --retry=3 --without omnibus_package docgen chefstyle
+if (-not $?) { throw "Unable to install gem dependencies" }