You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by sm...@apache.org on 2021/10/26 18:49:18 UTC

[geode] branch develop updated: [GEODE-9775] CI Changes to support CI migration

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

smgoller pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 4248006  [GEODE-9775] CI Changes to support CI migration
4248006 is described below

commit 4248006916a91f6d86976f77aea50a9dec729757
Author: Sean Goller <se...@goller.net>
AuthorDate: Tue Oct 26 18:48:17 2021 +0000

    [GEODE-9775] CI Changes to support CI migration
    
    * Remove unnecessary environment variables.
    * get network information from concourse instead of discovering it ourselves.
---
 ci/pipelines/geode-build/deploy_pipeline.sh | 10 ----------
 ci/pipelines/geode-build/jinja.template.yml |  3 +++
 ci/pipelines/images/jinja.template.yml      |  6 ++++++
 ci/scripts/build_image.sh                   | 16 ++--------------
 ci/scripts/create_instance.sh               | 23 ++++++++++++++++-------
 5 files changed, 27 insertions(+), 31 deletions(-)

diff --git a/ci/pipelines/geode-build/deploy_pipeline.sh b/ci/pipelines/geode-build/deploy_pipeline.sh
index f0e38ba..2cf1640 100755
--- a/ci/pipelines/geode-build/deploy_pipeline.sh
+++ b/ci/pipelines/geode-build/deploy_pipeline.sh
@@ -40,16 +40,6 @@ fi
 echo "Sanitized Geode Fork = ${SANITIZED_GEODE_FORK}"
 echo "Sanitized Geode Branch = ${SANITIZED_GEODE_BRANCH}"
 
-MY_NAME=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/name" -H "Metadata-Flavor: Google")
-MY_ZONE=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/zone" -H "Metadata-Flavor: Google")
-MY_ZONE=${MY_ZONE##*/}
-NETWORK_INTERFACE_INFO="$(gcloud compute instances describe ${MY_NAME} --zone ${MY_ZONE} --format="json(networkInterfaces)")"
-GCP_NETWORK=$(echo ${NETWORK_INTERFACE_INFO} | jq -r '.networkInterfaces[0].network')
-GCP_NETWORK=${GCP_NETWORK##*/}
-GCP_SUBNETWORK=$(echo ${NETWORK_INTERFACE_INFO} | jq -r '.networkInterfaces[0].subnetwork')
-GCP_SUBNETWORK=${GCP_SUBNETWORK##*/}
-ENV_ID=$(echo ${GCP_NETWORK} | awk -F- '{ print $1}')
-
 #echo "DEBUG INFO *****************************"
 #echo "Pipeline prefix = ${PIPELINE_PREFIX}"
 #echo "Docker image prefix = ${DOCKER_IMAGE_PREFIX}"
diff --git a/ci/pipelines/geode-build/jinja.template.yml b/ci/pipelines/geode-build/jinja.template.yml
index 82cee71..59dc0fb 100644
--- a/ci/pipelines/geode-build/jinja.template.yml
+++ b/ci/pipelines/geode-build/jinja.template.yml
@@ -60,6 +60,9 @@
 
 {% macro common_instance_params(test) -%}
 GCP_PROJECT: ((gcp-project))
+GCP_NETWORK: ((gcp-network))
+GCP_SUBNETWORK: ((gcp-subnet))
+GCP_ZONE: ((gcp-zone))
 CPUS: {{ test.CPUS }}
 RAM: {{ test.RAM }}
 DISK: {{ test.DISK }}
diff --git a/ci/pipelines/images/jinja.template.yml b/ci/pipelines/images/jinja.template.yml
index c5148c9..3c202d2 100644
--- a/ci/pipelines/images/jinja.template.yml
+++ b/ci/pipelines/images/jinja.template.yml
@@ -313,6 +313,9 @@ jobs:
         GEODE_DOCKER_IMAGE: gcr.io/((gcp-project))/((pipeline-prefix))test-container
         PIPELINE_PREFIX: ((pipeline-prefix))
         GCP_PROJECT: ((gcp-project))
+        GCP_NETWORK: ((gcp-network))
+        GCP_SUBNETWORK: ((gcp-subnet))
+        INTERNAL: "true"
         CONCOURSE_GCP_KEY: "((concourse-gcp-key))"
         JAVA_BUILD_VERSION: 8
       run:
@@ -348,6 +351,9 @@ jobs:
         GEODE_DOCKER_IMAGE: gcr.io/((gcp-project))/((pipeline-prefix))test-container
         PIPELINE_PREFIX: ((pipeline-prefix))
         GCP_PROJECT: ((gcp-project))
+        GCP_NETWORK: ((gcp-network))
+        GCP_SUBNETWORK: ((gcp-subnet))
+        INTERNAL: "true"
         CONCOURSE_GCP_KEY: "((concourse-gcp-key))"
         JAVA_BUILD_VERSION: 8
       run:
diff --git a/ci/scripts/build_image.sh b/ci/scripts/build_image.sh
index 0db5b48..ab3020f 100755
--- a/ci/scripts/build_image.sh
+++ b/ci/scripts/build_image.sh
@@ -32,20 +32,8 @@ if [[ -n "${CONCOURSE_GCP_KEY}" ]]; then
   export GOOGLE_APPLICATION_CREDENTIALS=${PACKERDIR}/credentials.json
 fi
 
-GCP_NETWORK="default"
-GCP_SUBNETWORK="default"
-
-MY_NAME=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/name" -H "Metadata-Flavor: Google")
-if [[ -n "${MY_NAME}" ]]; then
-  MY_ZONE=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/zone" -H "Metadata-Flavor: Google")
-  MY_ZONE=${MY_ZONE##*/}
-  NETWORK_INTERFACE_INFO="$(gcloud compute instances describe ${MY_NAME} --zone ${MY_ZONE} --format="json(networkInterfaces)")"
-  GCP_NETWORK=$(echo ${NETWORK_INTERFACE_INFO} | jq -r '.networkInterfaces[0].network')
-  GCP_NETWORK=${GCP_NETWORK##*/}
-  GCP_SUBNETWORK=$(echo ${NETWORK_INTERFACE_INFO} | jq -r '.networkInterfaces[0].subnetwork')
-  GCP_SUBNETWORK=${GCP_SUBNETWORK##*/}
-  INTERNAL=true
-fi
+GCP_NETWORK="${GCP_NETWORK:-default}"
+GCP_SUBNETWORK="${GCP_SUBNETWORK:-default}"
 
 if [[ -z "${GCP_PROJECT}" ]]; then
   echo "GCP_PROJECT is unset. Cowardly refusing to continue."
diff --git a/ci/scripts/create_instance.sh b/ci/scripts/create_instance.sh
index 1fc54ee..ce6b84b 100755
--- a/ci/scripts/create_instance.sh
+++ b/ci/scripts/create_instance.sh
@@ -48,6 +48,21 @@ if [[ -z "${IMAGE_FAMILY_NAME}" ]]; then
   exit 1
 fi
 
+if [[ -z "${GCP_NETWORK}" ]]; then
+  echo "GCP_NETWORK environment variable must be set for this script to work."
+  exit 1
+fi
+
+if [[ -z "${GCP_SUBNETWORK}" ]]; then
+  echo "GCP_SUBNETWORK environment variable must be set for this script to work."
+  exit 1
+fi
+
+if [[ -z "${GCP_ZONE}" ]]; then
+  echo "GCP_ZONE environment variable must be set for this script to work."
+  exit 1
+fi
+
 . ${SCRIPTDIR}/shared_utilities.sh
 is_source_from_pr_testable "geode" "$(get_geode_pr_exclusion_dirs)" || exit 0
 
@@ -87,14 +102,8 @@ if [[ -z "${IMAGE_NAME}" ]]; then
   exit 1
 fi
 
-MY_NAME=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/name" -H "Metadata-Flavor: Google")
-MY_ZONE=$(curl -s "http://metadata.google.internal/computeMetadata/v1/instance/zone" -H "Metadata-Flavor: Google")
+MY_ZONE=${GCP_ZONE}
 MY_ZONE=${MY_ZONE##*/}
-NETWORK_INTERFACE_INFO="$(gcloud compute instances describe ${MY_NAME} --zone ${MY_ZONE} --format="json(networkInterfaces)")"
-GCP_NETWORK=$(echo ${NETWORK_INTERFACE_INFO} | jq -r '.networkInterfaces[0].network')
-GCP_NETWORK=${GCP_NETWORK##*/}
-GCP_SUBNETWORK=$(echo ${NETWORK_INTERFACE_INFO} | jq -r '.networkInterfaces[0].subnetwork')
-GCP_SUBNETWORK=${GCP_SUBNETWORK##*/}
 
 # Determine and store our attempt number
 cp old/attempts new/