This is an automated email from the ASF dual-hosted git repository. rhoughton 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 3e3bdd3 allow AMI picking with arbitrary username accounts (#132) 3e3bdd3 is described below commit 3e3bdd3a371e400db0ce2ce2d736ab06f9244ed1 Author: Robert Houghton <rhough...@pivotal.io> AuthorDate: Wed Aug 12 09:58:16 2020 -0700 allow AMI picking with arbitrary username accounts (#132) * allow AMI picking with arbitrary username accounts * improved run directory settings --- infrastructure/build.gradle | 2 +- infrastructure/scripts/aws/destroy_cluster.sh | 11 +++++++++- infrastructure/scripts/aws/launch_cluster.sh | 24 ++++++++++++++++++++-- .../infrastructure/aws/AwsBenchmarkMetadata.java | 7 ++++++- .../geode/infrastructure/aws/LaunchCluster.java | 1 + 5 files changed, 40 insertions(+), 5 deletions(-) diff --git a/infrastructure/build.gradle b/infrastructure/build.gradle index 41f3a71..6b23c3b 100644 --- a/infrastructure/build.gradle +++ b/infrastructure/build.gradle @@ -43,7 +43,7 @@ task(launchCluster, dependsOn: 'classes', type: JavaExec) { systemProperty 'TEST_CI', project.findProperty('ci') systemProperty 'PURPOSE', project.findProperty('purpose') - + systemProperty 'USER', project.findProperty('user') } task(destroyCluster, dependsOn: 'classes', type: JavaExec) { diff --git a/infrastructure/scripts/aws/destroy_cluster.sh b/infrastructure/scripts/aws/destroy_cluster.sh index a56d8e2..5bab232 100755 --- a/infrastructure/scripts/aws/destroy_cluster.sh +++ b/infrastructure/scripts/aws/destroy_cluster.sh @@ -17,6 +17,15 @@ # See the License for the specific language governing permissions and # limitations under the License. + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + TAG= CI= @@ -63,6 +72,6 @@ if [ -z "${CI}" ]; then CI=0 fi -pushd ../../../ +pushd "${SCRIPTDIR}/../../../" ./gradlew destroyCluster -Pci=${CI} --args "${TAG}" popd diff --git a/infrastructure/scripts/aws/launch_cluster.sh b/infrastructure/scripts/aws/launch_cluster.sh index 600f0d9..c7d164a 100755 --- a/infrastructure/scripts/aws/launch_cluster.sh +++ b/infrastructure/scripts/aws/launch_cluster.sh @@ -19,6 +19,14 @@ set -e +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +SCRIPTDIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + TAG= COUNT= CI= @@ -55,6 +63,15 @@ while (( "$#" )); do exit 1 fi ;; + -u|--user ) + if [ "${2}" ]; then + USER="${2}" + shift + else + echo 'ERROR: "--user" requires a non-empty argument.' + exit 1 + fi + ;; -h|--help|-\? ) echo "Usage: $(basename "$0") -t tag -c 4 [options ...] [-- arguments ...]" echo "Options:" @@ -84,7 +101,10 @@ fi CI=${CI:-0} PURPOSE=${PURPOSE:-"geode-benchmarks"} +if [[ ! -z "${USER}" ]]; then + USER_ARG="-Puser=${USER}" +fi -pushd ../../../ -./gradlew launchCluster -Pci=${CI} -Ppurpose=${PURPOSE} --args "${TAG} ${COUNT}" +pushd "${SCRIPTDIR}/../../../" +./gradlew launchCluster "${USER_ARG}" -Pci=${CI} -Ppurpose=${PURPOSE} --args "${TAG} ${COUNT}" popd diff --git a/infrastructure/src/main/java/org/apache/geode/infrastructure/aws/AwsBenchmarkMetadata.java b/infrastructure/src/main/java/org/apache/geode/infrastructure/aws/AwsBenchmarkMetadata.java index ed99626..8ae430b 100644 --- a/infrastructure/src/main/java/org/apache/geode/infrastructure/aws/AwsBenchmarkMetadata.java +++ b/infrastructure/src/main/java/org/apache/geode/infrastructure/aws/AwsBenchmarkMetadata.java @@ -26,11 +26,16 @@ import org.apache.geode.infrastructure.BenchmarkMetadata; * Static methods to generate common strings used for AWS infrastructure. */ class AwsBenchmarkMetadata extends BenchmarkMetadata { - public static final String USER = "geode"; + public static String USER = "geode"; public static final int POLL_INTERVAL = 15000; public static InstanceType INSTANCE_TYPE = InstanceType.C5_18_XLARGE; public static Tenancy TENANCY = Tenancy.DEDICATED; + public static String setUserName(String user) { + USER = user; + return USER; + } + public static String securityGroup(String tag) { return BenchmarkMetadata.benchmarkString(tag, "securityGroup"); } 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 5068f92..ff2d96b 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 @@ -92,6 +92,7 @@ public class LaunchCluster { usage("Usage: LaunchCluster <tag> <count>"); } + AwsBenchmarkMetadata.setUserName(System.getProperty("USER", AwsBenchmarkMetadata.USER)); List<Tag> tags = getTags(benchmarkTag); createKeyPair(benchmarkTag); Image newestImage = getNewestImage();