Skip to content

Commit

Permalink
[GEODE-5864] Make PublishArtifacts use a heavy lifter.
Browse files Browse the repository at this point in the history
Co-authored-by: Sean Goller <[email protected]>
Co-authored-by: Robert Houghton <[email protected]>
  • Loading branch information
robbadler and smgoller committed Oct 16, 2018
1 parent 33076f9 commit 1d3985a
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 9 deletions.
56 changes: 47 additions & 9 deletions ci/pipelines/geode-build/jinja.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,28 +319,66 @@ jobs:
- name: PublishArtifacts
public: true
plan:
- get: geode
- get: geode-ci
- aggregate:
- get: geode
passed:
{% for test in tests if not (test.name=="StressNew" or test.name.startswith("Windows"))-%}
- {{test.name}}TestOpenJDK8
{% endfor %}
trigger: true
- get: geode-ci
- get: geode-build-version
params:
pre: build
- {{test.name}}TestOpenJDK8
{% endfor %}
trigger: true
- get: geode-build-version
params:
pre: build
- do:
- put: concourse-metadata-resource
- task: start_instance
{{ alpine_tools_config()|indent(8) }}
params:
{{ common_instance_params(publish_artifacts) | indent(12) }}
GEODE_BRANCH: {{repository.branch}}
GEODE_FORK: {{repository.fork}}
run:
path: geode-ci/ci/scripts/start_instance.sh
inputs:
- name: concourse-metadata-resource
- name: geode-ci
outputs:
- name: instance-data
timeout: 15m
attempts: 10
- task: rsync_code_up
{{ alpine_tools_config()|indent(4) }}
run:
path: geode-ci/ci/scripts/rsync_code_up.sh
inputs:
- name: geode-ci
- name: geode
- name: instance-data
timeout: 5m
- task: publish
{{ alpine_tools_config()|indent(4) }}
params:
MAINTENANCE_VERSION: ((geode-build-branch))
ARTIFACT_BUCKET: ((artifact-bucket))
SERVICE_ACCOUNT: ((!concourse-gcp-account))
run:
path: geode-ci/ci/scripts/publish.sh
path: geode-ci/ci/scripts/execute_publish.sh
inputs:
- name: geode
- name: geode-ci
- name: geode-build-version
ensure:
do:
- task: stop_instance
{{ alpine_tools_config()|indent(8) }}
run:
path: geode-ci/ci/scripts/stop_instance.sh
inputs:
- name: geode-ci
- name: instance-data
timeout: 1h

{% endif %}

{%- for test in tests if not test.name=="StressNew" %}
Expand Down
6 changes: 6 additions & 0 deletions ci/pipelines/shared/jinja.variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ build_test:
GRADLE_TASK: build
execute_test_timeout: 10m

publish_artifacts:
name: "PublishArtifacts"
CPUS: "8"
RAM: "16"
execute_test_timeout: 10m

java_test_versions:
- name: OpenJDK8
version: 8
Expand Down
75 changes: 75 additions & 0 deletions ci/scripts/execute_publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/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
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

BASE_DIR=$(pwd)

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 )"


ROOT_DIR=$(pwd)
BUILD_DATE=$(date +%s)
EMAIL_SUBJECT="results/subject"
EMAIL_BODY="results/body"

GEODE_BUILD_VERSION_FILE=${ROOT_DIR}/geode-build-version/number
GEODE_RESULTS_VERSION_FILE=${ROOT_DIR}/results/number
GEODE_BUILD_VERSION_NUMBER=$(grep "versionNumber *=" geode/gradle.properties | awk -F "=" '{print $2}' | tr -d ' ')
GEODE_BUILD_DIR=/tmp/geode-build
GEODE_PULL_REQUEST_ID_FILE=${ROOT_DIR}/geode/.git/id

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
CONCOURSE_VERSION=$(cat ${GEODE_BUILD_VERSION_FILE})
CONCOURSE_PRODUCT_VERSION=${CONCOURSE_VERSION%%-*}
GEODE_PRODUCT_VERSION=${GEODE_BUILD_VERSION_NUMBER}
CONCOURSE_BUILD_SLUG=${CONCOURSE_VERSION##*-}
BUILD_ID=${CONCOURSE_VERSION##*.}
FULL_PRODUCT_VERSION=${GEODE_PRODUCT_VERSION}-${CONCOURSE_BUILD_SLUG}
echo "Concourse VERSION is ${CONCOURSE_VERSION}"
echo "Geode product VERSION is ${GEODE_PRODUCT_VERSION}"
echo "Build ID is ${BUILD_ID}"
fi

echo -n "${FULL_PRODUCT_VERSION}" > ${GEODE_RESULTS_VERSION_FILE}

DEFAULT_GRADLE_TASK_OPTIONS="--parallel --console=plain --no-daemon"

SSHKEY_FILE="instance-data/sshkey"
SSH_OPTIONS="-i ${SSHKEY_FILE} -o ConnectionAttempts=60 -o StrictHostKeyChecking=no"

INSTANCE_IP_ADDRESS="$(cat instance-data/instance-ip-address)"

SET_JAVA_HOME="export JAVA_HOME=/usr/lib/jvm/java-${JAVA_BUILD_VERSION}-openjdk-amd64"

GRADLE_COMMAND="./gradlew \
${DEFAULT_GRADLE_TASK_OPTIONS} \
-PbuildId=${BUILD_ID} publish"

echo "${GRADLE_COMMAND}"
ssh ${SSH_OPTIONS} geode@${INSTANCE_IP_ADDRESS} "mkdir -p tmp && cd geode && ${SET_JAVA_HOME} && ${GRADLE_COMMAND}"

0 comments on commit 1d3985a

Please sign in to comment.