| { |
| "variables": { |
| "pipeline_prefix": "local-testing-", |
| "hashed_pipeline_prefix": "0b7ad56c-671b-5244-9f36-01f92928abf8", |
| "gcp_project": "unset", |
| "gcp_network": "default", |
| "gcp_subnetwork": "default", |
| "use_internal_ip": "false", |
| "java_build_version": "8", |
| "packer_ttl": "" |
| }, |
| "builders": [ |
| { |
| "image_name": "{{user `hashed_pipeline_prefix`}}wgb-{{timestamp}}", |
| "image_family": "{{user `pipeline_prefix`}}windows-geode-builder", |
| "type": "googlecompute", |
| "project_id": "{{user `gcp_project`}}", |
| "network": "{{user `gcp_network`}}", |
| "subnetwork": "{{user `gcp_subnetwork`}}", |
| "source_image": "{{ user `base_image`}}", |
| "disk_size": "100", |
| "machine_type": "n1-standard-4", |
| "communicator": "winrm", |
| "winrm_username": "geode", |
| "winrm_insecure": true, |
| "winrm_use_ssl": true, |
| "state_timeout": "10m", |
| "metadata": { |
| "windows-startup-script-cmd": "winrm quickconfig -quiet & net user /add geode & net localgroup administrators geode /add & winrm set winrm/config/service/auth @{Basic=\"true\"}" |
| }, |
| "zone": "us-central1-a", |
| "tags": ["packer"], |
| "omit_external_ip": false, |
| "use_internal_ip": "{{user `use_internal_ip`}}", |
| "labels": { |
| "time-to-live": "{{user `packer_ttl`}}", |
| "instance_type": "packer" |
| } |
| } |
| ], |
| "provisioners": [ |
| { |
| "type": "powershell", |
| "inline": [ |
| "(New-Object Net.WebClient).DownloadFile(\"https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.ps1\", \"c:/add-google-cloud-ops-agent-repo.ps1\")", |
| "Invoke-Expression \"c:/add-google-cloud-ops-agent-repo.ps1 -Verbose -AlsoInstall\"", |
| "while ($true) {", |
| " try {", |
| " Get-Service -Name google-cloud-ops-agent", |
| " break", |
| " } catch {", |
| " Write-Warning \"Wating on service google-cloud-ops-agent\"", |
| " Start-Sleep -s 10", |
| " }", |
| "}" |
| ] |
| }, |
| { |
| "type": "powershell", |
| "inline": [ |
| "$ErrorActionPreference = \"Stop\"", |
| "Set-ExecutionPolicy Bypass -Scope Process -Force", |
| "Install-WindowsFeature Containers" |
| ] |
| }, |
| { |
| "type": "powershell", |
| "inline": [ |
| "$ErrorActionPreference = \"Stop\"", |
| "Set-ExecutionPolicy Bypass -Scope Process -Force", |
| "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12", |
| "Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force", |
| "Install-Module DockerMsftProvider -Force", |
| "Install-Package Docker -ProviderName DockerMsftProvider -Force", |
| "New-Item \"C:\\ProgramData\\Docker\\config\\daemon.json\" -Force", |
| "Set-Content \"C:\\ProgramData\\Docker\\config\\daemon.json\" '{\"registry-mirrors\": [\"https://mirror.gcr.io\"]}'", |
| "Set-Service wuauserv -StartupType Disabled", |
| "Stop-Service wuauserv" |
| ] |
| }, |
| { |
| "type": "powershell", |
| "inline": [ |
| "$ErrorActionPreference = \"Stop\"", |
| "Set-ExecutionPolicy Bypass -Scope Process -Force", |
| "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12", |
| "Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression" |
| ] |
| }, |
| { |
| "type": "powershell", |
| "inline": [ |
| "$ErrorActionPreference = \"Stop\"", |
| "Set-ExecutionPolicy Bypass -Scope Process -Force", |
| "choco install -y git cygwin cyg-get liberica11jdk", |
| "Move-Item \"C:\\Program Files\\BellSoft\\LibericaJDK-11*\" c:\\java11", |
| "choco install -y liberica17jdk", |
| "Move-Item \"C:\\Program Files\\BellSoft\\LibericaJDK-17*\" c:\\java17", |
| "choco install -y liberica8jdk", |
| "Move-Item \"C:\\Program Files\\BellSoft\\LibericaJDK-8*\" c:\\java8", |
| "choco install openssh -params '/SSHServerFeature' -confirm", |
| "refreshenv", |
| "$OldPath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH).Path", |
| "$NewPath = $OldPath + ';' + 'c:\\Program Files\\Git\\bin' + ';' + 'c:\\tools\\cygwin\\bin'", |
| "Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH -Value $NewPath", |
| "refreshenv", |
| "cyg-get rsync" |
| ] |
| }, |
| { |
| "type": "powershell", |
| "inline": [ |
| "winrm set winrm/config/service '@{AllowUnencrypted=\"true\"}'", |
| "New-NetFirewallRule -DisplayName sshd -Direction inbound -Action allow -Protocol tcp -LocalPort 22", |
| "New-NetFirewallRule -DisplayName \"Docker containers\" -LocalAddress 172.0.0.0/8 -Action allow -Direction inbound" |
| ] |
| }, |
| { |
| "type": "powershell", |
| "inline": [ |
| |
| "write-output '>>>>>>>>>> Cloning geode repo <<<<<<<<<<'", |
| "& 'c:\\Program Files\\Git\\bin\\git.exe' clone -b develop --depth 1 https://github.com/apache/geode.git geode", |
| "pushd geode", |
| "$Env:JAVA_HOME = 'C:\\java8'", |
| ".\\gradlew.bat --no-daemon resolveDependencies", |
| "popd", |
| |
| "write-output '>>>>>>>>>> Killing all java processes <<<<<<<<<<'", |
| "kill -name java -force -ErrorAction ignore", |
| "Start-Sleep 10", |
| |
| "write-output '>>>>>>>>>> List remaining java processes for debug purposes <<<<<<<<<<'", |
| "ps -Name java -ErrorAction ignore", |
| |
| "write-output '>>>>>>>>>> Final cleanup <<<<<<<<<<'", |
| "pushd geode", |
| ".\\gradlew.bat --no-daemon clean", |
| "popd", |
| "rm -force -recurse geode" |
| ] |
| }, |
| { |
| "type": "windows-restart", |
| "restart_timeout": "30m" |
| }, |
| { |
| "type": "powershell", |
| "inline": [ |
| "GCESysprep -NoShutDown" |
| ] |
| } |
| ] |
| } |