Skip to content
Permalink
Browse files
Allow repository to by rsync'd from local host rather than cloned.
  • Loading branch information
pivotal-jbarrett committed Oct 15, 2019
1 parent d85f08e commit 1ea0d22ebb4b6a416312ae24bf992a97d36cc809
Showing 1 changed file with 29 additions and 26 deletions.
@@ -131,13 +131,17 @@ fi
fixRepoName() {
if [ -z "$1" ]; then
return 1
elif [ "${1:0:5}" = "https" ] || [ "${1:0:4}" = "git@" ]; then
elif [ "${1:0:6}" = "https:" ] || [ "${1:0:4}" = "git@" ] || [ "${1:0:6}" = "rsync:" ]; then
echo "${1}"
else
echo "https://github.com/${1}"
fi
}

remoteShell() {
ssh ${SSH_OPTIONS} "geode@${FIRST_INSTANCE}" "$@"
}

BENCHMARK_REPO=$(fixRepoName ${BENCHMARK_REPO})
REPO=$(fixRepoName ${REPO})

@@ -155,35 +159,36 @@ if [[ -z "${VERSION}" ]]; then
exit 1
fi

ssh ${SSH_OPTIONS} geode@$FIRST_INSTANCE "\
rm -rf geode && \
git clone ${REPO} geode && \
cd geode && git checkout ${BRANCH}"
if [ "${REPO:0:6}" = "rsync:" ]; then
pushd "${REPO:6}"
FILES=$(mktemp)
git ls-files > "${FILES}"
rsync -a -e "ssh ${SSH_OPTIONS}" --include='*/' --include='.git/***' --include-from="${FILES}" --exclude='*' . "geode@${FIRST_INSTANCE}:geode/"
rm -f "${FILES}"
popd
else
remoteShell rm -rf geode '&&' git clone "${REPO}" geode
fi
remoteShell cd geode '&&' git checkout "${BRANCH}"

set +e
for i in {1..5}; do
if ssh ${SSH_OPTIONS} geode@$FIRST_INSTANCE "\
cd geode && \
./gradlew resolveDependencies"; then
if remoteShell cd geode '&&' ./gradlew resolveDependencies; then
break
fi
done
set -e

if ssh ${SSH_OPTIONS} geode@$FIRST_INSTANCE "\
cd geode && \
./gradlew tasks --console plain | egrep '\publishToMavenLocal\b'"; then
if remoteShell cd geode '&&' ./gradlew tasks --console plain '|' egrep '\publishToMavenLocal\b'; then
install_target="publishToMavenLocal"
else
# install target is legacy but required for older releases
install_target="install"
fi

ssh ${SSH_OPTIONS} geode@$FIRST_INSTANCE "\
cd geode && \
./gradlew ${install_target} installDist"
remoteShell cd geode '&&' ./gradlew ${install_target} installDist

VERSION=$(ssh ${SSH_OPTIONS} geode@$FIRST_INSTANCE geode/geode-assembly/build/install/apache-geode/bin/gfsh version)
VERSION=$(remoteShell geode/geode-assembly/build/install/apache-geode/bin/gfsh version)
fi

if [[ -z "${VERSION}" ]]; then
@@ -192,33 +197,31 @@ if [[ -z "${VERSION}" ]]; then
fi

set +e
ssh ${SSH_OPTIONS} geode@$FIRST_INSTANCE "
[[ ! -r .geode-benchmarks-identifier ]] && \
uuidgen > .geode-benchmarks-identifier"
remoteShell "[[ ! -r .geode-benchmarks-identifier ]] && uuidgen > .geode-benchmarks-identifier"
set -e

instance_id=$(ssh ${SSH_OPTIONS} geode@$FIRST_INSTANCE cat .geode-benchmarks-identifier)
instance_id=$(remoteShell cat .geode-benchmarks-identifier)


ssh ${SSH_OPTIONS} geode@${FIRST_INSTANCE} \
remoteShell \
rm -rf geode-benchmarks '&&' \
git clone ${BENCHMARK_REPO} '&&' \
cd geode-benchmarks '&&' git checkout ${BENCHMARK_BRANCH}
git clone "${BENCHMARK_REPO}" '&&' \
cd geode-benchmarks '&&' git checkout "${BENCHMARK_BRANCH}"

BENCHMARK_SHA=$(ssh ${SSH_OPTIONS} geode@${FIRST_INSTANCE} \
BENCHMARK_SHA=$(remoteShell \
cd geode-benchmarks '&&' \
git rev-parse --verify -q HEAD)

BUILD_IDENTIFIER="$(uuidgen)"

METADATA="${METADATA},'source_repo':'${GEODE_REPO}','benchmark_repo':'${BENCHMARK_REPO}','benchmark_branch':'${BENCHMARK_BRANCH}','instance_id':'${instance_id}','benchmark_sha':'${BENCHMARK_SHA}','build_identifier':'${BUILD_IDENTIFIER}'"

ssh ${SSH_OPTIONS} geode@${FIRST_INSTANCE} \
remoteShell \
cd geode-benchmarks '&&' \
./gradlew -PgeodeVersion=${VERSION} benchmark "-Phosts=${HOSTS}" "-Pmetadata=${METADATA}" "$@"
./gradlew -PgeodeVersion="${VERSION}" benchmark "-Phosts=${HOSTS}" "-Pmetadata=${METADATA}" "$@"

mkdir -p ${OUTPUT}

scp ${SSH_OPTIONS} -r geode@${FIRST_INSTANCE}:geode-benchmarks/geode-benchmarks/build/reports ${OUTPUT}/reports
BENCHMARK_DIRECTORY="$(ssh ${SSH_OPTIONS} geode@${FIRST_INSTANCE} ls -l geode-benchmarks/geode-benchmarks/build/ | grep benchmark | awk 'NF>1{print $NF}')"
BENCHMARK_DIRECTORY="$(remoteShell ls -l geode-benchmarks/geode-benchmarks/build/ | grep benchmark | awk 'NF>1{print $NF}')"
scp ${SSH_OPTIONS} -r geode@${FIRST_INSTANCE}:geode-benchmarks/geode-benchmarks/build/${BENCHMARK_DIRECTORY} ${OUTPUT}

0 comments on commit 1ea0d22

Please sign in to comment.