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-benchmarks.git


The following commit(s) were added to refs/heads/develop by this push:
     new 9819b5f  GEODE-8348: Add support for customizable purpose tag. (#131)
9819b5f is described below

commit 9819b5f39c3f7dbbd25e467a9af9f60db368d949
Author: Sean Goller <[email protected]>
AuthorDate: Wed Jul 15 15:35:06 2020 -0700

    GEODE-8348: Add support for customizable purpose tag. (#131)
    
    * GEODE-8348: Add support for customizable purpose tag.
    
    * GEODE-8348: purpose value fixes.
---
 infrastructure/build.gradle                             |  2 ++
 infrastructure/scripts/aws/image/packer.json            |  5 +++--
 infrastructure/scripts/aws/launch_cluster.sh            | 17 +++++++++++++----
 .../apache/geode/infrastructure/aws/LaunchCluster.java  |  8 +++++++-
 4 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/infrastructure/build.gradle b/infrastructure/build.gradle
index 7fc8819..41f3a71 100644
--- a/infrastructure/build.gradle
+++ b/infrastructure/build.gradle
@@ -42,6 +42,8 @@ task(launchCluster, dependsOn: 'classes', type: JavaExec) {
   classpath = sourceSets.main.runtimeClasspath
 
   systemProperty 'TEST_CI', project.findProperty('ci')
+  systemProperty 'PURPOSE', project.findProperty('purpose')
+
 }
 
 task(destroyCluster, dependsOn: 'classes', type: JavaExec) {
diff --git a/infrastructure/scripts/aws/image/packer.json 
b/infrastructure/scripts/aws/image/packer.json
index 753524e..7a09685 100644
--- a/infrastructure/scripts/aws/image/packer.json
+++ b/infrastructure/scripts/aws/image/packer.json
@@ -1,7 +1,8 @@
 {
   "variables": {
     "aws_access_key": "",
-    "aws_secret_key": ""
+    "aws_secret_key": "",
+    "purpose": "geode-benchmarks"
   },
   "builders": [
     {
@@ -29,7 +30,7 @@
         "Release": "Latest",
         "Base_AMI_Name": "{{ .SourceAMIName }}",
         "Extra": "{{ .SourceAMITags.TagName }}",
-        "purpose": "geode-benchmarks"
+        "purpose": "{{user `purpose`}}"
       }
     }
   ],
diff --git a/infrastructure/scripts/aws/launch_cluster.sh 
b/infrastructure/scripts/aws/launch_cluster.sh
index b07fbe9..600f0d9 100755
--- a/infrastructure/scripts/aws/launch_cluster.sh
+++ b/infrastructure/scripts/aws/launch_cluster.sh
@@ -46,12 +46,22 @@ while (( "$#" )); do
     --ci )
       CI=1
       ;;
+    -p|--purpose )
+      if [ "${2}" ]; then
+        PURPOSE=${2}
+        shift
+      else
+        echo 'ERROR: "--purpose" requires a non-empty argument.'
+        exit 1
+      fi
+      ;;
     -h|--help|-\? )
       echo "Usage: $(basename "$0") -t tag -c 4 [options ...] [-- arguments 
...]"
       echo "Options:"
       echo "-t|--tag : Cluster tag"
       echo "-c|--count : The number of instances to start"
       echo "--ci : Set if starting instances for Continuous Integration"
+      echo "-p|--purpose : Purpose (Purpose tag to use for base AMI)"
       echo "-- : All subsequent arguments are passed to the benchmark task as 
arguments."
       echo "-h|--help : This help message"
       exit 1
@@ -72,10 +82,9 @@ if [[ -z "${AWS_ACCESS_KEY_ID}" ]]; then
   export AWS_PROFILE="geode-benchmarks"
 fi
 
-if [ -z "${CI}" ]; then
-  CI=0
-fi
+CI=${CI:-0}
+PURPOSE=${PURPOSE:-"geode-benchmarks"}
 
 pushd ../../../
-./gradlew launchCluster -Pci=${CI} --args "${TAG} ${COUNT}"
+./gradlew launchCluster -Pci=${CI} -Ppurpose=${PURPOSE} --args "${TAG} 
${COUNT}"
 popd
diff --git 
a/infrastructure/src/main/java/org/apache/geode/infrastructure/aws/LaunchCluster.java
 
b/infrastructure/src/main/java/org/apache/geode/infrastructure/aws/LaunchCluster.java
index 4fd7bb4..5068f92 100644
--- 
a/infrastructure/src/main/java/org/apache/geode/infrastructure/aws/LaunchCluster.java
+++ 
b/infrastructure/src/main/java/org/apache/geode/infrastructure/aws/LaunchCluster.java
@@ -397,11 +397,17 @@ public class LaunchCluster {
     DateTimeFormatter inputFormatter =
         DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", 
Locale.ENGLISH);
 
+    String purpose = System.getProperty("PURPOSE", "geode-benchmarks");
+
+    if (purpose.isEmpty()) {
+      purpose = "geode-benchmarks";
+    }
+
     // Find an appropriate AMI to launch our cluster with
     List<Image> benchmarkImages = ec2.describeImages(
         DescribeImagesRequest
             .builder()
-            
.filters(Filter.builder().name("tag:purpose").values("geode-benchmarks").build())
+            
.filters(Filter.builder().name("tag:purpose").values(purpose).build())
             .build())
         .images();
 

Reply via email to