From 587ddad5ef9574c230a87bb384938fa26cdfb94c Mon Sep 17 00:00:00 2001 From: Christian Breitwieser Date: Wed, 12 Jun 2019 14:34:30 +0200 Subject: [PATCH 1/3] Added additional powershell scripts for VM tuning --- packer-scripts/Compact.ps1 | 25 ++ .../Disable-Disturbing-Functionality.ps1 | 63 +++++ packer-scripts/Install-EssentialApps.ps1 | 34 +++ packer-scripts/Win-Updates.ps1 | 261 ++++++++++++++++++ 4 files changed, 383 insertions(+) create mode 100644 packer-scripts/Compact.ps1 create mode 100644 packer-scripts/Disable-Disturbing-Functionality.ps1 create mode 100644 packer-scripts/Install-EssentialApps.ps1 create mode 100644 packer-scripts/Win-Updates.ps1 diff --git a/packer-scripts/Compact.ps1 b/packer-scripts/Compact.ps1 new file mode 100644 index 000000000..6cc16fcdb --- /dev/null +++ b/packer-scripts/Compact.ps1 @@ -0,0 +1,25 @@ + +Write-Host "---------------------------------------------------------------------------------------------" +Write-Host $MyInvocation.MyCommand.Name +Write-Host "---------------------------------------------------------------------------------------------" + +dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase +#cleanmgr /sagerun:1 + +$doExtraCompact = $null +if(Test-Path env:doExtraCompact) +{ + $doExtraCompact = Get-Item env:doExtraCompact + + if($doExtraCompact.Value -eq 'true') + { + Write-Host "Performing extra compacting with Udefrag and Sdelete" + + choco install -y ultradefrag + choco install -y sdelete + + udefrag --optimize --repeat C: + sdelete.exe -q -z C: + } +} + diff --git a/packer-scripts/Disable-Disturbing-Functionality.ps1 b/packer-scripts/Disable-Disturbing-Functionality.ps1 new file mode 100644 index 000000000..914fa599b --- /dev/null +++ b/packer-scripts/Disable-Disturbing-Functionality.ps1 @@ -0,0 +1,63 @@ + +Write-Host "---------------------------------------------------------------------------------------------" +Write-Host $MyInvocation.MyCommand.Name +Write-Host "---------------------------------------------------------------------------------------------" + +$ErrorActionPreference = 'SilentlyContinue' + +Write-Host "Disable system protection, set pagefile to a fixed size" +Disable-ComputerRestore -Drive "C:\" + +Write-Host "Set pagefile to fixed size so we're not extending the image file unnecessarily" +$computersys = Get-WmiObject Win32_ComputerSystem -EnableAllPrivileges; +$computersys.AutomaticManagedPagefile = $False; +$computersys.Put(); +$pagefile = Get-WmiObject -Query "Select * From Win32_PageFileSetting Where Name like '%pagefile.sys'"; +$pagefile.InitialSize = 512; +$pagefile.MaximumSize = 512; +$pagefile.Put(); + + +Write-Host "Disable Defender" +Set-MpPreference -DisableRealtimeMonitoring $true + +# --> stuff below causes access denied problems... +# $DefenderPath = "HKLM:SOFTWARE\Policies\Microsoft\Windows Defender" +# New-Item -Path $DefenderPath -Force +# Set-ItemProperty -Path $DefenderPath -Type DWord -Name "DisableAntiSpyware" -Value 1 -Force + +# $DefenderRealTimePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows Defender\Real-Time Protection" +# New-Item -Path $DefenderRealTimePath -Force +# Set-ItemProperty -Path $DefenderRealTimePath -Type DWord -Name "DisableBehaviorMonitoring" -Value 1 -Force +# Set-ItemProperty -Path $DefenderRealTimePath -Type DWord -Name "DisableOnAccessProtection" -Value 1 -Force +# Set-ItemProperty -Path $DefenderRealTimePath -Type DWord -Name "DisableScanOnRealtimeEnable" -Value 1 -Force + +Write-Host "Setting scheduling priority for programs" +$Priority = "HKLM:SYSTEM\CurrentControlSet\Control\PriorityControl" +Set-ItemProperty -Path $Priority -Type DWord -Name Win32PrioritySeparation -Value 38 -Force + +Write-Host "Disable auto updates (hopefully)" +# see https://4sysops.com/archives/disable-windows-10-update-in-the-registry-and-with-powershell +$WindowsUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\" +$AutoUpdatePath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" + +New-Item -Path $WindowsUpdatePath -Force +New-Item -Path $AutoUpdatePath -Force + +Set-ItemProperty -Path $AutoUpdatePath -Type DWord -Name NoAutoUpdate -Value 0 -Force +Set-ItemProperty -Path $AutoUpdatePath -Type DWord -Name AUOptions -Value 2 -Force + + +Write-Host "Disable install of apps like CandyCrush, ..." +$CloudContentPath = "HKLM:SOFTWARE\Policies\Microsoft\Windows\CloudContent" +New-Item -Path $CloudContentPath -Force +Set-ItemProperty -Path $CloudContentPath -Type DWord -Name "DisableWindowsConsumerFeatures" -Value 1 -Force + +$ContentDeliveryManagerPath = "HKCU:Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" +New-Item -Path $ContentDeliveryManagerPath -Force +Set-ItemProperty -Path $ContentDeliveryManagerPath -Type DWord -Name "SilentInstalledAppsEnabled" -Value 0 -Force + +Write-Host "Disable Win-Store app updates" +$StorePath = "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" +New-Item -Path $StorePath -Force +Set-ItemProperty -Type DWord -Path $StorePath -Name "AutoDownload" -Value 2 -Force \ No newline at end of file diff --git a/packer-scripts/Install-EssentialApps.ps1 b/packer-scripts/Install-EssentialApps.ps1 new file mode 100644 index 000000000..33b34d6f7 --- /dev/null +++ b/packer-scripts/Install-EssentialApps.ps1 @@ -0,0 +1,34 @@ + +Set-ExecutionPolicy Bypass -Scope Process -Force; + +# Chocolatey +Write-Host "Chocolatey" +$chocoExePath = 'C:\ProgramData\Chocolatey\bin' + +if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower())) { + Write-Host "Chocolatey found in PATH, skipping install..." +} +else +{ + # Add to system PATH + $systemPath = [Environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::Machine) + $systemPath += ';' + $chocoExePath + [Environment]::SetEnvironmentVariable("PATH", $systemPath, [System.EnvironmentVariableTarget]::Machine) + + # Update local process' path + $userPath = [Environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::User) + if($userPath) { + $env:Path = $systemPath + ";" + $userPath + } else { + $env:Path = $systemPath + } + + # Run the installer + iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) +} + +# Nuget + PSWindowsUpdate +Write-Host "Installing Nuget + PSWindowsUpdate" + +Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force +Install-Module -Name PSWindowsUpdate -Force \ No newline at end of file diff --git a/packer-scripts/Win-Updates.ps1 b/packer-scripts/Win-Updates.ps1 new file mode 100644 index 000000000..425a175b1 --- /dev/null +++ b/packer-scripts/Win-Updates.ps1 @@ -0,0 +1,261 @@ +param($global:RestartRequired=0, + $global:MoreUpdates=0, + $global:MaxCycles=5, + $MaxUpdatesPerCycle=500) + +$ErrorActionPreference = 'SilentlyContinue' +$Logfile = "C:\Windows\Temp\win-updates.log" + +Write-Host "---------------------------------------------------------------------------------------------" +Write-Host $MyInvocation.MyCommand.Name +Write-Host "---------------------------------------------------------------------------------------------" + +function LogWrite { + Param ([string]$logstring) + $now = Get-Date -format s + Add-Content $Logfile -value "$now $logstring" + Write-Host $logstring +} + +function Check-ContinueRestartOrEnd() { + Write-Host "BEGIN AUTOUPDATE" + Get-WUHistory | Out-File C:\PSWindowsUpdate1.log + Get-WindowsUpdate -install -acceptall -ignorereboot | Get-WindowsUpdate -install -acceptall -ignorereboot | Out-File C:\PSWindowsUpdate2.log + Write-Host "COMPLETE AUTOUPDATE" + + $RegistryKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" + $RegistryEntry = "InstallWindowsUpdates" + switch ($global:RestartRequired) { + 0 { + $prop = (Get-ItemProperty $RegistryKey).$RegistryEntry + if ($prop) { + LogWrite "Restart Registry Entry Exists - Removing It" + Remove-ItemProperty -Path $RegistryKey -Name $RegistryEntry -ErrorAction SilentlyContinue + } + + LogWrite "No Restart Required" + Check-WindowsUpdates + + if (($global:MoreUpdates -eq 1) -and ($script:Cycles -le $global:MaxCycles)) { + Install-WindowsUpdates + } elseif ($script:Cycles -gt $global:MaxCycles) { + LogWrite "Exceeded Cycle Count - Stopping" + Invoke-Expression "a:\openssh.ps1 -AutoStart" + } else { + LogWrite "Done Installing Windows Updates" + Invoke-Expression "a:\openssh.ps1 -AutoStart" + } + } + 1 { + $prop = (Get-ItemProperty $RegistryKey).$RegistryEntry + if (-not $prop) { + LogWrite "Restart Registry Entry Does Not Exist - Creating It" + Set-ItemProperty -Path $RegistryKey -Name $RegistryEntry -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File $($script:ScriptPath) -MaxUpdatesPerCycle $($MaxUpdatesPerCycle)" + } else { + LogWrite "Restart Registry Entry Exists Already" + } + + LogWrite "Restart Required - Restarting..." + Restart-Computer -Force + } + default { + LogWrite "Unsure If A Restart Is Required" + break + } + } +} + +function Install-WindowsUpdates() { + $script:Cycles++ + LogWrite "Evaluating Available Updates with limit of $($MaxUpdatesPerCycle):" + $UpdatesToDownload = New-Object -ComObject 'Microsoft.Update.UpdateColl' + $script:i = 0; + $CurrentUpdates = $SearchResult.Updates + while($script:i -lt $CurrentUpdates.Count -and $script:CycleUpdateCount -lt $MaxUpdatesPerCycle) { + $Update = $CurrentUpdates.Item($script:i) + if (($Update -ne $null) -and (!$Update.IsDownloaded)) { + [bool]$addThisUpdate = $false + if ($Update.InstallationBehavior.CanRequestUserInput) { + LogWrite "> Skipping: $($Update.Title) because it requires user input" + } else { + if (!($Update.EulaAccepted)) { + LogWrite "> Note: $($Update.Title) has a license agreement that must be accepted. Accepting the license." + $Update.AcceptEula() + [bool]$addThisUpdate = $true + $script:CycleUpdateCount++ + } else { + [bool]$addThisUpdate = $true + $script:CycleUpdateCount++ + } + } + + if ([bool]$addThisUpdate) { + LogWrite "Adding: $($Update.Title)" + $UpdatesToDownload.Add($Update) |Out-Null + } + } + $script:i++ + } + + if ($UpdatesToDownload.Count -eq 0) { + LogWrite "No Updates To Download..." + } else { + LogWrite 'Downloading Updates...' + $ok = 0; + while (! $ok) { + try { + $Downloader = $UpdateSession.CreateUpdateDownloader() + $Downloader.Updates = $UpdatesToDownload + $Downloader.Download() + $ok = 1; + } catch { + LogWrite $_.Exception | Format-List -force + LogWrite "Error downloading updates. Retrying in 30s." + $script:attempts = $script:attempts + 1 + Start-Sleep -s 30 + } + } + } + + $UpdatesToInstall = New-Object -ComObject 'Microsoft.Update.UpdateColl' + [bool]$rebootMayBeRequired = $false + LogWrite 'The following updates are downloaded and ready to be installed:' + foreach ($Update in $SearchResult.Updates) { + if (($Update.IsDownloaded)) { + LogWrite "> $($Update.Title)" + $UpdatesToInstall.Add($Update) |Out-Null + + if ($Update.InstallationBehavior.RebootBehavior -gt 0){ + [bool]$rebootMayBeRequired = $true + } + } + } + + if ($UpdatesToInstall.Count -eq 0) { + LogWrite 'No updates available to install...' + $global:MoreUpdates=0 + $global:RestartRequired=0 + Invoke-Expression "a:\openssh.ps1 -AutoStart" + break + } + + if ($rebootMayBeRequired) { + LogWrite 'These updates may require a reboot' + $global:RestartRequired=1 + } + + LogWrite 'Installing updates...' + + $Installer = $script:UpdateSession.CreateUpdateInstaller() + $Installer.Updates = $UpdatesToInstall + $InstallationResult = $Installer.Install() + + LogWrite "Installation Result: $($InstallationResult.ResultCode)" + LogWrite "Reboot Required: $($InstallationResult.RebootRequired)" + LogWrite 'Listing of updates installed and individual installation results:' + if ($InstallationResult.RebootRequired) { + $global:RestartRequired=1 + } else { + $global:RestartRequired=0 + } + + for($i=0; $i -lt $UpdatesToInstall.Count; $i++) { + New-Object -TypeName PSObject -Property @{ + Title = $UpdatesToInstall.Item($i).Title + Result = $InstallationResult.GetUpdateResult($i).ResultCode + } + LogWrite "Item: $($UpdatesToInstall.Item($i).Title)" + LogWrite "Result: $($InstallationResult.GetUpdateResult($i).ResultCode)" + } + + Check-ContinueRestartOrEnd +} + +function Check-WindowsUpdates() { + LogWrite "Checking For Windows Updates" + $Username = $env:USERDOMAIN + "\" + $env:USERNAME + + New-EventLog -Source $ScriptName -LogName 'Windows Powershell' -ErrorAction SilentlyContinue + + $Message = "Script: " + $ScriptPath + "`nScript User: " + $Username + "`nStarted: " + (Get-Date).toString() + + Write-EventLog -LogName 'Windows Powershell' -Source $ScriptName -EventID "104" -EntryType "Information" -Message $Message + LogWrite $Message + + $script:UpdateSearcher = $script:UpdateSession.CreateUpdateSearcher() + $script:successful = $FALSE + $script:attempts = 0 + $script:maxAttempts = 12 + while(-not $script:successful -and $script:attempts -lt $script:maxAttempts) { + try { + $script:SearchResult = $script:UpdateSearcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0") + $script:successful = $TRUE + } catch { + LogWrite $_.Exception | Format-List -force + LogWrite "Search call to UpdateSearcher was unsuccessful. Retrying in 10s." + $script:attempts = $script:attempts + 1 + Start-Sleep -s 10 + } + } + + if ($SearchResult.Updates.Count -ne 0) { + $Message = "There are " + $SearchResult.Updates.Count + " more updates." + LogWrite $Message + try { + for($i=0; $i -lt $script:SearchResult.Updates.Count; $i++) { + LogWrite $script:SearchResult.Updates.Item($i).Title + LogWrite $script:SearchResult.Updates.Item($i).Description + LogWrite $script:SearchResult.Updates.Item($i).RebootRequired + LogWrite $script:SearchResult.Updates.Item($i).EulaAccepted + } + $global:MoreUpdates=1 + } catch { + LogWrite $_.Exception | Format-List -force + LogWrite "Showing SearchResult was unsuccessful. Rebooting." + $global:RestartRequired=1 + $global:MoreUpdates=0 + Check-ContinueRestartOrEnd + LogWrite "Show never happen to see this text!" + Restart-Computer -Force + } + } else { + LogWrite 'There are no applicable updates' + $global:RestartRequired=0 + $global:MoreUpdates=0 + } +} + +$script:ScriptName = $MyInvocation.MyCommand.ToString() +$script:ScriptPath = $MyInvocation.MyCommand.Path +$script:UpdateSession = New-Object -ComObject 'Microsoft.Update.Session' +$script:UpdateSession.ClientApplicationID = 'Packer Windows Update Installer' +$script:UpdateSearcher = $script:UpdateSession.CreateUpdateSearcher() +$script:SearchResult = New-Object -ComObject 'Microsoft.Update.UpdateColl' +$script:Cycles = 0 +$script:CycleUpdateCount = 0 + +Check-WindowsUpdates +if ($global:MoreUpdates -eq 1) { + Install-WindowsUpdates +} else { + Check-ContinueRestartOrEnd +} + + +winrm quickconfig -q +winrm quickconfig -transport:http +winrm set winrm/config '@{MaxTimeoutms="7200000"}' +winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="0"}' +winrm set winrm/config/winrs '@{MaxProcessesPerShell="0"}' +winrm set winrm/config/winrs '@{MaxShellsPerUser="0"}' +winrm set winrm/config/service '@{AllowUnencrypted="true"}' +winrm set winrm/config/service/auth '@{Basic="true"}' +winrm set winrm/config/client/auth '@{Basic="true"}' +winrm set winrm/config/listener?Address=*+Transport=HTTP '@{Port="5985"} ' + +netsh advfirewall firewall set rule group="remote administration" new enable=yes +netsh firewall add portopening TCP 5985 "Port 5985" +net stop winrm +sc.exe config winrm start=auto +net start winrm + From a0118a477accd0a3920f73749ec1a9cf226890b7 Mon Sep 17 00:00:00 2001 From: Christian Breitwieser Date: Wed, 12 Jun 2019 14:35:08 +0200 Subject: [PATCH 2/3] Utilizing new provisining scripts + extended pre-installed packages slightly --- ci-windows-2019.yml | 74 ++++++++++++------- .../windows-server-2019-packages.txt | 13 ++-- 2 files changed, 56 insertions(+), 31 deletions(-) diff --git a/ci-windows-2019.yml b/ci-windows-2019.yml index 3c147dacc..c1b24a956 100644 --- a/ci-windows-2019.yml +++ b/ci-windows-2019.yml @@ -9,6 +9,8 @@ variables: travis_cookbooks_edge_branch: master travis_cookbooks_sha: "{{ env `TRAVIS_COOKBOOKS_SHA` }}" travis_uid: "{{ env `TRAVIS_UID` }}" + + builders: - type: googlecompute name: googlecompute @@ -32,6 +34,8 @@ builders: - windows-2019 - travis-ci-packer-templates state_timeout: 10m + + provisioners: - type: file source: tmp/git-meta @@ -42,44 +46,62 @@ provisioners: - type: file source: packer-scripts/Run-BashScript.ps1 destination: c:/windows/temp/Run-BashScript.ps1 + +- type: powershell + scripts: + - packer-scripts/Install-EssentialApps.ps1 +- type: powershell + scripts: + - packer-scripts/Disable-Disturbing-Functionality.ps1 + - type: powershell scripts: - packer-scripts/Bootstrap-Windows.ps1 environment_vars: - "JOB_BOARD_REGISTER_FILE=c:/travis-job-board-register.yml" - "SYSTEM_INFO_JSON=c:/travis_system_info.json" + +# - type: powershell +# scripts: +# - packer-scripts/packer-env-dump +# - packer-scripts/clone-travis-cookbooks +# environment_vars: +# - CHEF_TMP=/c/windows/temp/chef-stuff +# - GIT_META_DIR=/c/windows/temp/git-meta +# - PACKER_ENV_DIR=/c/.packer-env +# - TRAVIS_COOKBOOKS_BRANCH={{ user `travis_cookbooks_branch` }} +# - TRAVIS_COOKBOOKS_SHA={{ user `travis_cookbooks_sha` }} +# execute_command: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. {{.Vars}}; & c:/windows/temp/Run-BashScript.ps1 -bashscript '{{.Path}}'; exit $LastExitCode }" +# - type: powershell +# scripts: +# # TODO: write job board data via chef +# - packer-scripts/create-windows-job-board-data +# - packer-scripts/create-image-metadata-tarball +# environment_vars: +# - "IMAGE_METADATA_TARBALL=/c/windows/temp/image-metadata-{{ user `image_name` }}.tar.bz2" +# - JOB_BOARD_REGISTER_FILE=/c/travis-job-board-register.yml +# - JOB_BOARD_IMAGE_DIST={{ user `dist_name` }} +# - PACKER_ENV_DIR=/c/.packer-env +# - SYSTEM_INFO_JSON=/c/travis_system_info.json +# - TMPDIR=/c/windows/temp +# - NODE_ATTRIBUTES_YML=/c/.node-attributes.yml +# - RSPEC_JSON_DIR=/c/Users/travis +# - DPKG_MANIFEST_JSON=/c/.dpkg-manifest.json +# - BIN_LIB_CHECKSUMS=/c/.bin-lib.SHA256SUMS +# execute_command: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. {{.Vars}}; & c:/windows/temp/Run-BashScript.ps1 -bashscript '{{.Path}}'; exit $LastExitCode }" + - type: powershell scripts: - - packer-scripts/packer-env-dump - - packer-scripts/clone-travis-cookbooks - environment_vars: - - CHEF_TMP=/c/windows/temp/chef-stuff - - GIT_META_DIR=/c/windows/temp/git-meta - - PACKER_ENV_DIR=/c/.packer-env - - TRAVIS_COOKBOOKS_BRANCH={{ user `travis_cookbooks_branch` }} - - TRAVIS_COOKBOOKS_SHA={{ user `travis_cookbooks_sha` }} - execute_command: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. {{.Vars}}; & c:/windows/temp/Run-BashScript.ps1 -bashscript '{{.Path}}'; exit $LastExitCode }" -- type: powershell - scripts: - # TODO: write job board data via chef - - packer-scripts/create-windows-job-board-data - - packer-scripts/create-image-metadata-tarball - environment_vars: - - "IMAGE_METADATA_TARBALL=/c/windows/temp/image-metadata-{{ user `image_name` }}.tar.bz2" - - JOB_BOARD_REGISTER_FILE=/c/travis-job-board-register.yml - - JOB_BOARD_IMAGE_DIST={{ user `dist_name` }} - - PACKER_ENV_DIR=/c/.packer-env - - SYSTEM_INFO_JSON=/c/travis_system_info.json - - TMPDIR=/c/windows/temp - - NODE_ATTRIBUTES_YML=/c/.node-attributes.yml - - RSPEC_JSON_DIR=/c/Users/travis - - DPKG_MANIFEST_JSON=/c/.dpkg-manifest.json - - BIN_LIB_CHECKSUMS=/c/.bin-lib.SHA256SUMS - execute_command: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. {{.Vars}}; & c:/windows/temp/Run-BashScript.ps1 -bashscript '{{.Path}}'; exit $LastExitCode }" + - packer-scripts/Compact.ps1 + environment_vars: + - "doExtraCompact=true" + - type: file source: "c:/windows/temp/image-metadata-{{ user `image_name` }}.tar.bz2" destination: tmp/image-metadata-{{ user `image_name` }}.tar.bz2 direction: download + + post-processors: - - type: shell-local diff --git a/packer-assets/windows-server-2019-packages.txt b/packer-assets/windows-server-2019-packages.txt index 39694da7e..6c31e971e 100644 --- a/packer-assets/windows-server-2019-packages.txt +++ b/packer-assets/windows-server-2019-packages.txt @@ -11,10 +11,13 @@ rsync ruby wget winscp -visualstudio2017buildtools --package-parameters "--quiet --wait --norestart --locale en-US --allWorkloads --includeRecommended --includeOptional --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.ATL --add Microsoft.VisualStudio.Component.VC.ATLMFC" -visualstudio2017-workload-netcorebuildtools -visualstudio2017-workload-vctools -visualstudio2017-workload-webbuildtools +visualstudio2019-workload-netcorebuildtools +visualstudio2019-workload-vctools +visualstudio2019-workload-webbuildtools +visualstudio2019buildtools --execution-timeout 3500 --package-parameters "--quiet --wait --norestart --locale en-US --allWorkloads --includeRecommended --includeOptional --add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.ATL --add Microsoft.VisualStudio.Component.VC.ATLMFC" windows-sdk-10-version-1903-all -vcredist2017 wsl +dotnet4.7.2 +dotnetcore-sdk +sysinternals +nodejs.install \ No newline at end of file From ede7247bb3b0b4a8bfcc52d15416ee12cc9b7bbe Mon Sep 17 00:00:00 2001 From: Christian Breitwieser Date: Wed, 12 Jun 2019 14:46:00 +0200 Subject: [PATCH 3/3] Fixed commented section for testing purposes --- ci-windows-2019.yml | 56 ++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/ci-windows-2019.yml b/ci-windows-2019.yml index c1b24a956..6ebff55c7 100644 --- a/ci-windows-2019.yml +++ b/ci-windows-2019.yml @@ -61,34 +61,34 @@ provisioners: - "JOB_BOARD_REGISTER_FILE=c:/travis-job-board-register.yml" - "SYSTEM_INFO_JSON=c:/travis_system_info.json" -# - type: powershell -# scripts: -# - packer-scripts/packer-env-dump -# - packer-scripts/clone-travis-cookbooks -# environment_vars: -# - CHEF_TMP=/c/windows/temp/chef-stuff -# - GIT_META_DIR=/c/windows/temp/git-meta -# - PACKER_ENV_DIR=/c/.packer-env -# - TRAVIS_COOKBOOKS_BRANCH={{ user `travis_cookbooks_branch` }} -# - TRAVIS_COOKBOOKS_SHA={{ user `travis_cookbooks_sha` }} -# execute_command: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. {{.Vars}}; & c:/windows/temp/Run-BashScript.ps1 -bashscript '{{.Path}}'; exit $LastExitCode }" -# - type: powershell -# scripts: -# # TODO: write job board data via chef -# - packer-scripts/create-windows-job-board-data -# - packer-scripts/create-image-metadata-tarball -# environment_vars: -# - "IMAGE_METADATA_TARBALL=/c/windows/temp/image-metadata-{{ user `image_name` }}.tar.bz2" -# - JOB_BOARD_REGISTER_FILE=/c/travis-job-board-register.yml -# - JOB_BOARD_IMAGE_DIST={{ user `dist_name` }} -# - PACKER_ENV_DIR=/c/.packer-env -# - SYSTEM_INFO_JSON=/c/travis_system_info.json -# - TMPDIR=/c/windows/temp -# - NODE_ATTRIBUTES_YML=/c/.node-attributes.yml -# - RSPEC_JSON_DIR=/c/Users/travis -# - DPKG_MANIFEST_JSON=/c/.dpkg-manifest.json -# - BIN_LIB_CHECKSUMS=/c/.bin-lib.SHA256SUMS -# execute_command: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. {{.Vars}}; & c:/windows/temp/Run-BashScript.ps1 -bashscript '{{.Path}}'; exit $LastExitCode }" +- type: powershell + scripts: + - packer-scripts/packer-env-dump + - packer-scripts/clone-travis-cookbooks + environment_vars: + - CHEF_TMP=/c/windows/temp/chef-stuff + - GIT_META_DIR=/c/windows/temp/git-meta + - PACKER_ENV_DIR=/c/.packer-env + - TRAVIS_COOKBOOKS_BRANCH={{ user `travis_cookbooks_branch` }} + - TRAVIS_COOKBOOKS_SHA={{ user `travis_cookbooks_sha` }} + execute_command: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. {{.Vars}}; & c:/windows/temp/Run-BashScript.ps1 -bashscript '{{.Path}}'; exit $LastExitCode }" +- type: powershell + scripts: + # TODO: write job board data via chef + - packer-scripts/create-windows-job-board-data + - packer-scripts/create-image-metadata-tarball + environment_vars: + - "IMAGE_METADATA_TARBALL=/c/windows/temp/image-metadata-{{ user `image_name` }}.tar.bz2" + - JOB_BOARD_REGISTER_FILE=/c/travis-job-board-register.yml + - JOB_BOARD_IMAGE_DIST={{ user `dist_name` }} + - PACKER_ENV_DIR=/c/.packer-env + - SYSTEM_INFO_JSON=/c/travis_system_info.json + - TMPDIR=/c/windows/temp + - NODE_ATTRIBUTES_YML=/c/.node-attributes.yml + - RSPEC_JSON_DIR=/c/Users/travis + - DPKG_MANIFEST_JSON=/c/.dpkg-manifest.json + - BIN_LIB_CHECKSUMS=/c/.bin-lib.SHA256SUMS + execute_command: powershell -executionpolicy bypass "& { if (Test-Path variable:global:ProgressPreference){$ProgressPreference='SilentlyContinue'};. {{.Vars}}; & c:/windows/temp/Run-BashScript.ps1 -bashscript '{{.Path}}'; exit $LastExitCode }" - type: powershell scripts: