diff options
author | Bryan McLellan <btm@chef.io> | 2020-05-13 16:30:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-13 16:30:01 -0400 |
commit | aaf93801274f437d03dce045a5cc2734f089271b (patch) | |
tree | e15cc325584e515f5167f3f8034f93b7f9d84c2a | |
parent | 2e58fd6d0b95003b1b5b2722373ca5cde835dcb7 (diff) | |
parent | 82a20300c36ff632224efcafd8758c684d86dc51 (diff) | |
download | chef-aaf93801274f437d03dce045a5cc2734f089271b.tar.gz |
Merge pull request #9857 from chef/btm/win10-e2e
private end to end windows 10 pipeline
-rw-r--r-- | .expeditor/config.yml | 5 | ||||
-rw-r--r-- | .expeditor/verify_private.pipeline.yml | 37 | ||||
-rw-r--r-- | .expeditor/verify_public.pipeline.yml (renamed from .expeditor/verify.pipeline.yml) | 0 | ||||
-rw-r--r-- | kitchen-tests/cookbooks/end_to_end/recipes/windows.rb | 65 | ||||
-rw-r--r-- | kitchen-tests/kitchen.azure.yml | 39 | ||||
-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 |
9 files changed, 174 insertions, 61 deletions
diff --git a/.expeditor/config.yml b/.expeditor/config.yml index c5b5c83e06..1c982033c2 100644 --- a/.expeditor/config.yml +++ b/.expeditor/config.yml @@ -24,8 +24,11 @@ docker_images: - chef pipelines: - - verify: + - verify/public: + definition: .expeditor/verify_public.pipeline.yml public: true + - verify/private: + definition: .expeditor/verify_private.pipeline.yml - verify/habitat: description: > A temporary pipeline to verify the habitat plans. Performs a local build, diff --git a/.expeditor/verify_private.pipeline.yml b/.expeditor/verify_private.pipeline.yml new file mode 100644 index 0000000000..03d871bba9 --- /dev/null +++ b/.expeditor/verify_private.pipeline.yml @@ -0,0 +1,37 @@ +--- +expeditor: + cached_folders: + - vendor + defaults: + buildkite: + retry: + automatic: + limit: 1 + timeout_in_minutes: 30 + +steps: + +######################################################################### + # START TEST KITCHEN ONLY +######################################################################### + +- label: "Kitchen Tests Windows 10" + commands: + - scripts/bk_tests/bk_win_prep.ps1 + - cd kitchen-tests + - kitchen test end-to-end-windows-10 + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + KITCHEN_YAML: kitchen.azure.yml + expeditor: + secrets: + AZURE_TENANT_ID: + account: azure/engineering-dev-test + field: tenant_id + AZURE_CLIENT_ID: + account: azure/engineering-dev-test + field: client_id + AZURE_CLIENT_SECRET: + account: azure/engineering-dev-test + field: client_secret diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify_public.pipeline.yml index 1791e3228c..1791e3228c 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify_public.pipeline.yml diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb b/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb new file mode 100644 index 0000000000..2d228badfb --- /dev/null +++ b/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb @@ -0,0 +1,65 @@ +# +# Cookbook:: end_to_end +# Recipe:: windows +# +# Copyright:: Copyright (c) Chef Software Inc. +# + +# hostnames on windows cannot contain a '.' +# hostname on windows requires a reboot +# hostname "chef-bk-ci" + +chef_sleep "2" + +execute "dir" + +powershell_script "sleep 1 second" do + code "Start-Sleep -s 1" + live_stream true +end + +powershell_script "sensitive sleep" do + code "Start-Sleep -s 1" + sensitive true +end + +timezone "UTC" + +include_recipe "ntp" + +users_manage "remove sysadmin" do + group_name "sysadmin" + group_id 2300 + action [:remove] +end + +# FIXME: create is not idempotent. it fails with a windows error if this already exists. +users_manage "create sysadmin" do + group_name "sysadmin" + group_id 2300 + action [:create] +end + +include_recipe "chef-client::delete_validation" +include_recipe "chef-client::config" + +include_recipe "git" + +# test various archive formats in the archive_file resource +%w{tourism.tar.gz tourism.tar.xz tourism.zip}.each do |archive| + cookbook_file File.join(Chef::Config[:file_cache_path], archive) do + source archive + end + + archive_file archive do + path File.join(Chef::Config[:file_cache_path], archive) + extract_to File.join(Chef::Config[:file_cache_path], archive.tr(".", "_")) + end +end + +locale "set system locale" do + lang "en_US.UTF-8" + only_if { debian? } +end + +include_recipe "::_ohai_hint" diff --git a/kitchen-tests/kitchen.azure.yml b/kitchen-tests/kitchen.azure.yml new file mode 100644 index 0000000000..c44c76579b --- /dev/null +++ b/kitchen-tests/kitchen.azure.yml @@ -0,0 +1,39 @@ +--- +driver: + name: azurerm + +driver_config: + subscription_id: 80b824de-ec53-4116-9868-3deeab10b0cd + location: West US2 + machine_size: Standard_B4ms + +provisioner: + name: chef_zero + deprecations_as_errors: true + chef_license: accept-no-persist + product_name: chef + client_rb: + diff_disabled: true + always_dump_stacktrace: true + +transport: + name: winrm + +verifier: + name: inspec + format: progress + +platforms: +- name: windows-10 + driver: + image_id: /subscriptions/80b824de-ec53-4116-9868-3deeab10b0cd/resourceGroups/EDM_Master_Storage_Resource_Group/providers/Microsoft.Compute/images/testkitchen-win-10 + use_managed_disk: true + winrm_powershell_script: |- + Set-WSManQuickConfig -Force -SkipNetworkProfileCheck + netsh advfirewall firewall set rule name="Windows Remote Management (HTTP-In)" profile=public protocol=tcp localport=5985 remoteip=localsubnet new remoteip=any + Set-PSRepository -Name PSGallery -InstallationPolicy Trusted + +suites: + - name: end-to-end + run_list: + - recipe[end_to_end::windows] 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 |