You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by rh...@apache.org on 2019/01/16 17:33:07 UTC
[geode] branch develop updated: GEODE-6279 Correct pull-request-id
encoding in URL (#3081)
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.git
The following commit(s) were added to refs/heads/develop by this push:
new d9945a1 GEODE-6279 Correct pull-request-id encoding in URL (#3081)
d9945a1 is described below
commit d9945a13fff439e4e4c77b59472b2d3668b05424
Author: Robert Houghton <rh...@pivotal.io>
AuthorDate: Wed Jan 16 09:32:55 2019 -0800
GEODE-6279 Correct pull-request-id encoding in URL (#3081)
* Extract common semver version parsing to shared_utilities.sh
* Fix use of pull-request resource to get PR number
* Cleanup pointlessly used buildid version file ; use modified input as obvious output.
Co-authored-by: Patrick Rhomberg <pr...@pivotal.io>
Co-authored-by: Robert Houghton <rh...@pivotal.io>
---
ci/pipelines/geode-build/jinja.template.yml | 2 +-
ci/scripts/archive_results.sh | 20 +--------
ci/scripts/execute_build.sh | 31 +++-----------
ci/scripts/execute_publish.sh | 23 +++-------
ci/scripts/shared_utilities.sh | 65 ++++++++++++++++++-----------
5 files changed, 55 insertions(+), 86 deletions(-)
diff --git a/ci/pipelines/geode-build/jinja.template.yml b/ci/pipelines/geode-build/jinja.template.yml
index c6719cd..efd9a5c 100644
--- a/ci/pipelines/geode-build/jinja.template.yml
+++ b/ci/pipelines/geode-build/jinja.template.yml
@@ -267,7 +267,7 @@ jobs:
timeout: 5m
- put: geode-build-version
params:
- file: results/number
+ file: geode-build-version/number
ensure:
do:
- aggregate:
diff --git a/ci/scripts/archive_results.sh b/ci/scripts/archive_results.sh
index 8043e93..75d195f 100755
--- a/ci/scripts/archive_results.sh
+++ b/ci/scripts/archive_results.sh
@@ -1,6 +1,5 @@
#!/usr/bin/env bash
-#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -68,27 +67,12 @@ if [ -z ${MAINTENANCE_VERSION+x} ]; then
fi
if [ -e "${GEODE_PULL_REQUEST_ID_FILE}" ]; then
- GEODE_PULL_REQUEST_ID=$(cat ${GEODE_PULL_REQUEST_ID_FILE})
FULL_PRODUCT_VERSION="geode-pr-${GEODE_PULL_REQUEST_ID}"
else
- # semver resource, e.g., "1.9.0-SNAPSHOT.325"
CONCOURSE_VERSION=$(cat ${GEODE_BUILD_VERSION_FILE})
- # Prune all after '-', yielding e.g., "1.9.0"
- GEODE_PRODUCT_VERSION=${CONCOURSE_VERSION%%-*}
- # Prune all before '-', yielding e.g., "SNAPSHOT.325"
- CONCOURSE_BUILD_SLUG=${CONCOURSE_VERSION##*-}
- # Prune all before '.', yielding e.g., "SNAPSHOT"
- QUALIFIER_SLUG=${CONCOURSE_BUILD_SLUG%%.*}
- # Prune all before '.', yielding e.g., "325"
- BUILD_ID=$(printf "%04d" ${CONCOURSE_VERSION##*.})
-
- # Rebuild version, zero-padded
- FULL_PRODUCT_VERSION=${GEODE_PRODUCT_VERSION}-${QUALIFIER_SLUG}.${BUILD_ID}
-
echo "Concourse VERSION is ${CONCOURSE_VERSION}"
- echo "Geode product VERSION is ${GEODE_PRODUCT_VERSION}"
- echo "Full product VERSION is ${FULL_PRODUCT_VERSION}"
- echo "Build ID is ${BUILD_ID}"
+ # Rebuild version, zero-padded
+ FULL_PRODUCT_VERSION=$(get-full-version ${CONCOURSE_VERSION})
fi
diff --git a/ci/scripts/execute_build.sh b/ci/scripts/execute_build.sh
index d4bb521..f6ed893 100755
--- a/ci/scripts/execute_build.sh
+++ b/ci/scripts/execute_build.sh
@@ -28,6 +28,7 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
[[ $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 )"
+source ${SCRIPTDIR}/shared_utilities.sh
if [[ -z "${GRADLE_TASK}" ]]; then
echo "GRADLE_TASK must be set. exiting..."
@@ -40,38 +41,18 @@ BUILD_DATE=$(date +%s)
# Precheckin does not get a geode-build-version
if [ -e "${ROOT_DIR}/geode-build-version" ] ; then
GEODE_BUILD_VERSION_FILE=${ROOT_DIR}/geode-build-version/number
- GEODE_RESULTS_VERSION_FILE=${ROOT_DIR}/results/number
GEODE_BUILD_DIR=/tmp/geode-build
- GEODE_PULL_REQUEST_ID_FILE=${ROOT_DIR}/geode/.git/id
+ GEODE_PULL_REQUEST_ID_FILE=${ROOT_DIR}/geode/.git/resource/version.json
if [ -e "${GEODE_PULL_REQUEST_ID_FILE}" ]; then
- GEODE_PULL_REQUEST_ID=$(cat ${GEODE_PULL_REQUEST_ID_FILE})
+ GEODE_PULL_REQUEST_ID=$(cat ${GEODE_PULL_REQUEST_ID_FILE} | jq --raw-output '.["pr"]')
FULL_PRODUCT_VERSION="geode-pr-${GEODE_PULL_REQUEST_ID}"
- echo -n "${FULL_PRODUCT_VERSION}" > ${GEODE_RESULTS_VERSION_FILE}
else
- # semver resource, e.g., "1.9.0-SNAPSHOT.325"
CONCOURSE_VERSION=$(cat ${GEODE_BUILD_VERSION_FILE})
- # Prune all after '-', yielding e.g., "1.9.0"
- GEODE_PRODUCT_VERSION=${CONCOURSE_VERSION%%-*}
- # Prune all before '-', yielding e.g., "SNAPSHOT.325"
- CONCOURSE_BUILD_SLUG=${CONCOURSE_VERSION##*-}
- # Prune all before '.', yielding e.g., "SNAPSHOT"
- QUALIFIER_SLUG=${CONCOURSE_BUILD_SLUG%%.*}
- # Prune all before '.', yielding e.g., "325"
- BUILD_ID=$(printf "%04d" ${CONCOURSE_VERSION##*.})
-
- # Rebuild version, zero-padded
- FULL_PRODUCT_VERSION=${GEODE_PRODUCT_VERSION}-${QUALIFIER_SLUG}.${BUILD_ID}
-
echo "Concourse VERSION is ${CONCOURSE_VERSION}"
- echo "Geode product VERSION is ${GEODE_PRODUCT_VERSION}"
- echo "Full product VERSION is ${FULL_PRODUCT_VERSION}"
- echo "Build ID is ${BUILD_ID}"
-
- # The version passed in by concourse has an incremented buildId.
- # We pass it back out to persist that count.
- # The buildId must not be zero-padded to be compatible with the Concourse resource.
- echo -n "${CONCOURSE_VERSION}" > ${GEODE_RESULTS_VERSION_FILE}
+ # Rebuild version, zero-padded
+ FULL_PRODUCT_VERSION=$(get-full-version ${CONCOURSE_VERSION})
+ BUILD_ID=$(get-geode-build-id-padded ${CONCOURSE_VERSION} 2> /dev/null)
fi
fi
diff --git a/ci/scripts/execute_publish.sh b/ci/scripts/execute_publish.sh
index 5069b4d..fe972ec 100755
--- a/ci/scripts/execute_publish.sh
+++ b/ci/scripts/execute_publish.sh
@@ -28,6 +28,7 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
[[ $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 )"
+source ${SCRIPTDIR}/shared_utilities.sh
ROOT_DIR=$(pwd)
@@ -38,30 +39,16 @@ EMAIL_BODY="results/body"
GEODE_BUILD_VERSION_FILE=${ROOT_DIR}/geode-build-version/number
GEODE_RESULTS_VERSION_FILE=${ROOT_DIR}/results/number
GEODE_BUILD_DIR=/tmp/geode-build
-GEODE_PULL_REQUEST_ID_FILE=${ROOT_DIR}/geode/.git/id
+GEODE_PULL_REQUEST_ID_FILE=${ROOT_DIR}/geode/.git/resource/version.json
if [ -e "${GEODE_PULL_REQUEST_ID_FILE}" ]; then
- GEODE_PULL_REQUEST_ID=$(cat ${GEODE_PULL_REQUEST_ID_FILE})
+ GEODE_PULL_REQUEST_ID=$(cat ${GEODE_PULL_REQUEST_ID_FILE} | jq --raw-output '.["pr"]')
FULL_PRODUCT_VERSION="geode-pr-${GEODE_PULL_REQUEST_ID}"
else
- # semver resource, e.g., "1.9.0-SNAPSHOT.325"
CONCOURSE_VERSION=$(cat ${GEODE_BUILD_VERSION_FILE})
- # Prune all after '-', yielding e.g., "1.9.0"
- GEODE_PRODUCT_VERSION=${CONCOURSE_VERSION%%-*}
- # Prune all before '-', yielding e.g., "SNAPSHOT.325"
- CONCOURSE_BUILD_SLUG=${CONCOURSE_VERSION##*-}
- # Prune all before '.', yielding e.g., "SNAPSHOT"
- QUALIFIER_SLUG=${CONCOURSE_BUILD_SLUG%%.*}
- # Prune all before '.', yielding e.g., "325"
- BUILD_ID=$(printf "%04d" ${CONCOURSE_VERSION##*.})
-
- # Rebuild version, zero-padded
- FULL_PRODUCT_VERSION=${GEODE_PRODUCT_VERSION}-${QUALIFIER_SLUG}.${BUILD_ID}
-
echo "Concourse VERSION is ${CONCOURSE_VERSION}"
- echo "Geode product VERSION is ${GEODE_PRODUCT_VERSION}"
- echo "Full product VERSION is ${FULL_PRODUCT_VERSION}"
- echo "Build ID is ${BUILD_ID}"
+ # Rebuild version, zero-padded
+ FULL_PRODUCT_VERSION=$(get-full-version ${CONCOURSE_VERSION})
fi
DEFAULT_GRADLE_TASK_OPTIONS="--parallel --console=plain --no-daemon"
diff --git a/ci/scripts/shared_utilities.sh b/ci/scripts/shared_utilities.sh
index d1a3326..d5cec55 100644
--- a/ci/scripts/shared_utilities.sh
+++ b/ci/scripts/shared_utilities.sh
@@ -30,31 +30,48 @@ find-here-test-reports() {
echo ""
}
+## Parsing functions for the Concourse Semver resource.
+## These functions expect one input in the form of the resource file, e.g., "1.9.0-SNAPSHOT.325"
+get-geode-version() {
+ local CONCOURSE_VERSION=$1
+ # Prune all after '-', yielding e.g., "1.9.0"
+ local GEODE_PRODUCT_VERSION=${CONCOURSE_VERSION%%-*}
+ (>&2 echo "Geode product VERSION is ${GEODE_PRODUCT_VERSION}")
+ echo ${GEODE_PRODUCT_VERSION}
+}
+get-geode-version-qualifier-slug() {
+ local CONCOURSE_VERSION=$1
+ # Prune all before '-', yielding e.g., "SNAPSHOT.325"
+ local CONCOURSE_BUILD_SLUG=${CONCOURSE_VERSION##*-}
+ # Prune all before '.', yielding e.g., "SNAPSHOT"
+ local QUALIFIER_SLUG=${CONCOURSE_BUILD_SLUG%%.*}
+ echo ${QUALIFIER_SLUG}
+}
-function sendFailureJobEmail {
- echo "Sending job failure email"
-
- cat <<EOF >${EMAIL_SUBJECT}
-Build for version ${FULL_PRODUCT_VERSION} of Apache Geode failed.
-EOF
-
- cat <<EOF >${EMAIL_BODY}
-=================================================================================================
-
-The build job for Apache Geode version ${FULL_PRODUCT_VERSION} has failed.
-
-
-Build artifacts are available at:
-http://${BUILD_ARTIFACTS_DESTINATION}
-
-Test results are available at:
-http://${TEST_RESULTS_DESTINATION}
-
-
-Job: \${ATC_EXTERNAL_URL}/teams/\${BUILD_TEAM_NAME}/pipelines/\${BUILD_PIPELINE_NAME}/jobs/\${BUILD_JOB_NAME}/builds/\${BUILD_NAME}
+get-geode-build-id() {
+ local CONCOURSE_VERSION=$1
+ # Prune all before the last '.', yielding e.g., "325"
+ local BUILD_ID=${CONCOURSE_VERSION##*.}
+ echo ${BUILD_ID}
+}
-=================================================================================================
-EOF
+get-geode-build-id-padded() {
+ local CONCOURSE_VERSION=$1
+ local BUILD_ID=$(get-geode-build-id ${CONCOURSE_VERSION})
+ # Prune all before the last '.', yielding e.g., "325", then zero-pad, e.g., "0325"
+ local PADDED_BUILD_ID=$(printf "%04d" ${BUILD_ID})
+ (>&2 echo "Build ID is ${PADDED_BUILD_ID}")
+ echo ${PADDED_BUILD_ID}
+}
-}
\ No newline at end of file
+get-full-version() {
+ # Extract each component so that the BuildId can be zero-padded, then reassembled.
+ local CONCOURSE_VERSION=$1
+ local GEODE_PRODUCT_VERSION=$(get-geode-version ${CONCOURSE_VERSION})
+ local QUALIFIER_SLUG=$(get-geode-version-qualifier-slug ${CONCOURSE_VERSION})
+ local PADDED_BUILD_ID=$(get-geode-build-id-padded ${CONCOURSE_VERSION})
+ local FULL_PRODUCT_VERSION="${GEODE_PRODUCT_VERSION}-${QUALIFIER_SLUG}.${PADDED_BUILD_ID}"
+ (>&2 echo "Full product VERSION is ${FULL_PRODUCT_VERSION}")
+ echo ${FULL_PRODUCT_VERSION}
+}