You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by on...@apache.org on 2019/08/20 22:20:56 UTC

[geode] 17/21: Fix packer configuration for windows image. (#3837)

This is an automated email from the ASF dual-hosted git repository.

onichols pushed a commit to branch release/1.9.1
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 97acee90b9bbb201c02a3bcabb503cf05c3cfdb0
Author: Sean Goller <se...@goller.net>
AuthorDate: Wed Jul 24 03:53:28 2019 -0700

    Fix packer configuration for windows image. (#3837)
    
    * Docker needs to be started up, and needs to be elevated.
    * Made openjdk image pulled to be generic because they change
    * Added option to build script to add build arguments to packer call.
    
    (cherry picked from commit 6ee2e72114b0885a55746e898bd0210987d81143)
---
 .../google-windows-geode-builder/build_image.sh    |  3 ++-
 .../windows-packer.json                            | 24 ++++++++++++++--------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/ci/images/google-windows-geode-builder/build_image.sh b/ci/images/google-windows-geode-builder/build_image.sh
index 8c6c3cd..c5dd1a4 100755
--- a/ci/images/google-windows-geode-builder/build_image.sh
+++ b/ci/images/google-windows-geode-builder/build_image.sh
@@ -18,6 +18,7 @@
 set -x
 
 PACKER=${PACKER:-packer135}
+PACKER_ARGS="${*}"
 INTERNAL=${INTERNAL:-true}
 SOURCE="${BASH_SOURCE[0]}"
 while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
@@ -56,7 +57,7 @@ fi
 HASHED_PIPELINE_PREFIX="i$(uuidgen -n @dns -s -N "${PIPELINE_PREFIX}")-"
 
 echo "Running packer"
-PACKER_LOG=1 ${PACKER} build \
+PACKER_LOG=1 ${PACKER} build ${PACKER_ARGS} \
   --var "geode_docker_image=${GEODE_DOCKER_IMAGE}" \
   --var "pipeline_prefix=${PIPELINE_PREFIX}" \
   --var "hashed_pipeline_prefix=${HASHED_PIPELINE_PREFIX}" \
diff --git a/ci/images/google-windows-geode-builder/windows-packer.json b/ci/images/google-windows-geode-builder/windows-packer.json
index 4c6ee0c..c364d3c 100644
--- a/ci/images/google-windows-geode-builder/windows-packer.json
+++ b/ci/images/google-windows-geode-builder/windows-packer.json
@@ -61,7 +61,6 @@
         "Move-Item \"C:\\java8tmp\" c:\\java8",
         "choco install -y openssh --version 7.7.2.1 /SSHServerFeature",
         "refreshenv",
-
         "$a = 10",
         "do {",
         "write-output \">>>>>>>>>> Installing rsync: $a attempts remaining <<<<<<<<<<\"",
@@ -69,7 +68,6 @@
         "$a--",
         "} while (-not (test-path C:\\ProgramData\\chocolatey\\bin\\rsync.exe) -and $a -gt 0)",
         "get-item C:\\ProgramData\\chocolatey\\bin\\rsync.exe",
-
         "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",
@@ -78,14 +76,24 @@
         "$NewPath = $OldPath + ';' + 'c:\\Program Files\\Git\\bin'",
         "Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name PATH -Value $NewPath",
         "write-output '>>>>>>>>>> Modify sshd config to comment use of administrators authorized key file <<<<<<<<<<'",
-        "(Get-Content \"C:\\Program Files\\OpenSSH-Win64\\sshd_config_default\") -replace '(Match Group administrators)', '#$1' -replace '(\\s*AuthorizedKeysFile.*)', '#$1' | Out-File \"C:\\Program Files\\OpenSSH-Win64\\sshd_config_default\" -encoding UTF8",
+        "(Get-Content \"C:\\Program Files\\OpenSSH-Win64\\sshd_config_default\") -replace '(Match Group administrators)', '#$1' -replace '(\\s*AuthorizedKeysFile.*)', '#$1' | Out-File \"C:\\Program Files\\OpenSSH-Win64\\sshd_config_default\" -encoding UTF8"
+      ]
+    },
+    {
+      "type":  "powershell",
+      "elevated_user": "geode",
+      "elevated_password": "{{.WinRMPassword}}",
+      "inline": [
+        "net start \"Docker Engine\"",
         "write-output '>>>>>>>>>> Adding openjdk docker image <<<<<<<<<<'",
-        "docker pull openjdk:8u212-jdk-windowsservercore-1809",
+        "docker pull openjdk:8",
         "write-output '>>>>>>>>>> Removing unused docker images <<<<<<<<<<'",
-        "docker rmi microsoft/windowsservercore:1809",
-        "docker rmi microsoft/nanoserver:1809",
-
-        "Set-Content -Path c:\\ProgramData\\docker\\config\\daemon.json -Value '{ \"hosts\": [\"tcp://0.0.0.0:2375\", \"npipe://\"] }'",
+        "Set-Content -Path c:\\ProgramData\\docker\\config\\daemon.json -Value '{ \"hosts\": [\"tcp://0.0.0.0:2375\", \"npipe://\"] }'"
+      ]
+    },
+    {
+      "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",