Skip to content

Commit

Permalink
GEODE-7923: update release scripts to handle support branches (apache…
Browse files Browse the repository at this point in the history
…#4874)

* GEODE-7923: update release scripts to handle support branches
  • Loading branch information
onichols-pivotal authored Mar 31, 2020
1 parent 0320dc1 commit 232cfa1
Show file tree
Hide file tree
Showing 11 changed files with 742 additions and 279 deletions.
4 changes: 2 additions & 2 deletions ci/pipelines/meta/deploy_meta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ elif [[ "$GEODE_FORK" == "${UPSTREAM_FORK}" ]] && [[ "$GEODE_BRANCH" == "develop
echo "Disabling optional jobs for develop"
pauseNewJobs ${META_PIPELINE} set-pr-pipeline set-metrics-pipeline set-examples-pipeline
else
echo "Disabling unnecessary jobs for release branches."
echo "Disabling unnecessary jobs for support branches."
echo "*** DO NOT RE-ENABLE THESE META-JOBS ***"
pauseJobs ${META_PIPELINE} set-images-pipeline set-reaper-pipeline
pauseNewJobs ${META_PIPELINE} set-pr-pipeline set-metrics-pipeline set-examples-pipeline
Expand All @@ -277,8 +277,8 @@ driveToGreen $META_PIPELINE set-pipeline
unpausePipeline ${PIPELINE_PREFIX}main

if [[ "$GEODE_FORK" == "${UPSTREAM_FORK}" ]]; then
exposePipelines ${PIPELINE_PREFIX}main ${PIPELINE_PREFIX}images
if [[ "${PUBLIC}" == "true" ]]; then
exposePipelines ${PIPELINE_PREFIX}main ${PIPELINE_PREFIX}images
enableFeature metrics
enableFeature examples
fi
Expand Down
15 changes: 11 additions & 4 deletions dev-tools/release/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
This directory contains scripts to help create a release of geode.
This directory contains scripts to help create a release of geode and manage branches.

Not all release steps have scripts. Please follow all instructions as documented in the wiki:
https://cwiki.apache.org/confluence/display/GEODE/Releasing+Apache+Geode

Scripts
These scripts are intended to be run from the parent directory of your geode develop checkout, e.g.
# cd ..
# geode/dev-tools/release/foo.sh

Overview of scripts:

create_support_branches.sh: cuts support/x.y from develop for all projects and walks you through creating pipelines and setting version numbers
set_versions.sh: updates files that need to contain the version number planned for the next release from this support branch
prepare_rc.sh: Checks out the various geode repos, builds a release candidate, and publishes to nexus staging repo
commit_rc.sh: Pushes the tags and artifacts staged by prepare_rc.sh and then runs print_rc_email.sh
print_rc_email.sh: Generates an email to send to the dev list announcing a release candidate
promote_rc.sh: Tags an RC as the final release, builds docker images, and starts the mirroring and brew processes
finalize_release.sh: merges to master and cleans up pipelines and branches
promote_rc.sh: Tags an RC as the final release, builds docker images, merges to master, and starts the mirroring and brew processes
end_of_support.sh: cleans up pipelines and branches after 9-month life of support branch is reached
6 changes: 4 additions & 2 deletions dev-tools/release/commit_rc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ else
exit 1
fi

VERSION_MM=${VERSION%.*}

set -x
WORKSPACE=$PWD/release-${VERSION}-workspace
GEODE=$WORKSPACE/geode
Expand Down Expand Up @@ -123,8 +125,8 @@ echo "============================================================"
echo "Done publishing the release candidate! Next steps:"
echo "============================================================"
cd ${GEODE}/../..
echo "1. ${0%/*}/deploy_rc_pipeline.sh -v ${VERSION}"
echo "2. Monitor https://concourse.apachegeode-ci.info/teams/main/pipelines/apache-release-${VERSION//./-}-rc until all green"
echo "1. ${0%/*}/deploy_rc_pipeline.sh -v ${VERSION_MM}"
echo "2. Monitor https://concourse.apachegeode-ci.info/teams/main/pipelines/apache-support-${VERSION_MM//./-}-rc until all green"
echo "3. Send the following email to announce the RC:"
echo "To: [email protected]"
echo "Subject: [VOTE] Apache Geode ${FULL_VERSION}"
Expand Down
220 changes: 220 additions & 0 deletions dev-tools/release/create_support_branches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
#!/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

usage() {
echo "Usage: create_support_branches.sh -v version_number -g your_github_username"
echo " -v The #.# version number of the support branch to create"
echo " -g Your github username"
exit 1
}

VERSION_MM=""
GITHUB_USER=""

while getopts ":v:g:" opt; do
case ${opt} in
v )
VERSION_MM=$OPTARG
;;
g )
GITHUB_USER=$OPTARG
;;
\? )
usage
;;
esac
done

if [[ ${VERSION_MM} == "" ]] || [[ ${GITHUB_USER} == "" ]] ; then
usage
fi

if [[ $VERSION_MM =~ ^([0-9]+\.[0-9]+)$ ]]; then
true
else
echo "Malformed version number ${VERSION_MM}. Example valid version: 1.9"
exit 1
fi

MAJOR=${VERSION_MM%.*}
MINOR=${VERSION_MM#*.}

#tip: hardcode NEWMAJOR and NEWMINOR as needed if jumping to a new major
NEWMAJOR=${MAJOR}
NEWMINOR=$((MINOR + 1))

NEWVERSION=${NEWMAJOR}.${NEWMINOR}
NEWVERSION_NODOT=${NEWVERSION//./}

set -x
WORKSPACE=$PWD/support-${VERSION_MM}-workspace
GEODE=$WORKSPACE/geode
GEODE_DEVELOP=$WORKSPACE/geode-develop
GEODE_EXAMPLES=$WORKSPACE/geode-examples
GEODE_NATIVE=$WORKSPACE/geode-native
GEODE_BENCHMARKS=$WORKSPACE/geode-benchmarks
set +x


function failMsg1 {
echo "ERROR: script did NOT complete successfully. Please try again."
}
trap failMsg1 ERR


echo ""
echo "============================================================"
echo "Cleaning workspace directory..."
echo "============================================================"
set -x
rm -rf $WORKSPACE
mkdir -p $WORKSPACE
cd $WORKSPACE
set +x


echo ""
echo "============================================================"
echo "Cloning repositories..."
echo "============================================================"
set -x
git clone --single-branch --branch develop [email protected]:apache/geode.git
git clone --single-branch --branch develop [email protected]:apache/geode.git geode-develop
git clone --single-branch --branch develop [email protected]:apache/geode-examples.git
git clone --single-branch --branch develop [email protected]:apache/geode-native.git
git clone --single-branch --branch develop [email protected]:apache/geode-benchmarks.git
set +x


function failMsg2 {
errln=$1
echo "ERROR: script did NOT complete successfully"
echo "Comment out any steps that already succeeded (approximately lines 70-$(( errln - 1 ))) and try again"
}
trap 'failMsg2 $LINENO' ERR


echo ""
echo "============================================================"
echo "Creating support/${VERSION_MM} branches"
echo "============================================================"
for DIR in ${GEODE} ${GEODE_EXAMPLES} ${GEODE_NATIVE} ${GEODE_BENCHMARKS} ; do
set -x
cd ${DIR}
git checkout -b support/${VERSION_MM}
git push -u origin HEAD
set +x
done


echo ""
echo "============================================================"
echo "Bumping version on develop to ${NEWVERSION}"
echo "============================================================"
set -x
cd ${GEODE_DEVELOP}
git pull
git remote add myfork [email protected]:${GITHUB_USER}/geode.git || true
git checkout -b roll-develop-to-${NEWVERSION}
set +x

#version = 1.13.0-SNAPSHOT
sed -e "s/^version =.*/version = ${NEWVERSION}-SNAPSHOT/" -i.bak gradle.properties

# initial_version: 1.12.0
sed -e "s/^ initial_version:.*/ initial_version: ${NEWVERSION}/" -i.bak ./ci/pipelines/shared/jinja.variables.yml

VER=geode-serialization/src/main/java/org/apache/geode/internal/serialization/Version.java
#add the new ordinal and Version constants and set them as current&highest
CURORD=$(cat $VER | awk '/private static final short GEODE_.*_ORDINAL/{print $NF}' | tr -d ';' | sort -n | tail -1)
NEWORD=$(( CURORD + 5 ))
sed -e "s#/. NOTE: when adding a new version#private static final short GEODE_${NEWMAJOR}_${NEWMINOR}_0_ORDINAL = ${NEWORD};\\
\\
@Immutable\\
public static final Version GEODE_${NEWMAJOR}_${NEWMINOR}_0 =\\
new Version("'"'"GEODE"'"'", "'"'"${NEWMAJOR}.${NEWMINOR}.0"'"'", (byte) ${NEWMAJOR}, (byte) ${NEWMINOR}, (byte) 0, (byte) 0, GEODE_${NEWMAJOR}_${NEWMINOR}_0_ORDINAL);\\
\\
/* NOTE: when adding a new version#" \
-e "/public static final Version CURRENT/s#GEODE[0-9_]*#GEODE_${NEWMAJOR}_${NEWMINOR}_0#" \
-e "/public static final int HIGHEST_VERSION/s# = [0-9]*# = ${NEWORD}#" \
-i.bak $VER

COM=geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CommandInitializer.java
#add to list of all commands
sed -e "s#return Collections.unmodifiableMap(allCommands#allCommands.put(Version.GEODE_${NEWMAJOR}_${NEWMINOR}_0, geode18Commands);\\
return Collections.unmodifiableMap(allCommands#" \
-i.bak $COM

# directory: docs/guide/113
# product_version: '1.13'
# product_version_nodot: '113'
# product_version_geode: '1.13'
sed -E \
-e "s#docs/guide/[0-9]+#docs/guide/${NEWVERSION_NODOT}#" \
-e "s#product_version: '[0-9.]+'#product_version: '${NEWVERSION}'#" \
-e "s#version_nodot: '[0-9]+'#version_nodot: '${NEWVERSION_NODOT}'#" \
-e "s#product_version_geode: '[0-9.]+'#product_version_geode: '${NEWVERSION}'#" \
-i.bak geode-book/config.yml

#rewrite '/', '/docs/guide/113/about_geode.html'
#rewrite '/index.html', '/docs/guide/113/about_geode.html'
sed -E -e "s#docs/guide/[0-9]+#docs/guide/${NEWVERSION_NODOT}#" -i.bak geode-book/redirects.rb

rm gradle.properties.bak ci/pipelines/shared/jinja.variables.yml.bak geode-book/config.yml.bak geode-book/redirects.rb.bak $VER.bak* $COM.bak*
set -x
git add .
git diff --staged

./gradlew clean
./gradlew build -Dskip.tests=true
./gradlew updateExpectedPom

git commit -a -m "roll develop to ${NEWVERSION} now that support/${VERSION_MM} has been created"
git push -u myfork
set +x


echo ""
echo "============================================================"
echo "Setting version on support/${VERSION_MM}"
echo "============================================================"
set -x
${0%/*}/set_versions.sh -v ${VERSION_MM}.0
set +x


echo ""
echo "============================================================"
echo "Logging you in to concourse"
echo "============================================================"
set -x
fly -t concourse.apachegeode-ci.info-main login --team-name main --concourse-url https://concourse.apachegeode-ci.info/
set +x


echo ""
echo "============================================================"
echo "Done creating support branches"
echo "============================================================"
cd ${GEODE}/../..
echo "Next steps:"
echo "1. Go to https://github.com/${GITHUB_USER}/geode/pull/new/roll-develop-to-${NEWVERSION} and create the pull request"
echo "2. Plus the BumpMinor job at https://concourse.apachegeode-ci.info/teams/main/pipelines/apache-develop-main?group=Semver%20Management"
echo "3. Add the new version to Jira at https://issues.apache.org/jira/projects/GEODE?selectedItem=com.atlassian.jira.jira-projects-plugin:release-page"
echo "4. (cd ${GEODE}/ci/pipelines/meta && ./deploy_meta.sh) #takes about 2 hours. keep re-running until successful."
30 changes: 15 additions & 15 deletions dev-tools/release/deploy_rc_pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,61 +19,61 @@ set -e

usage() {
echo "Usage: deploy_rc_pipeline -v version_number"
echo " -v The #.#.# version number"
echo " -v The #.# version number"
exit 1
}

VERSION=""
VERSION_MM=""

while getopts ":v:" opt; do
case ${opt} in
v )
VERSION=$OPTARG
VERSION_MM=$OPTARG
;;
\? )
usage
;;
esac
done

if [[ ${VERSION} == "" ]]; then
if [[ ${VERSION_MM} == "" ]]; then
usage
fi

if [[ $VERSION =~ ^([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
if [[ $VERSION_MM =~ ^([0-9]+\.[0-9]+)$ ]]; then
true
else
echo "Malformed version number ${VERSION}. Example valid version: 1.9.0"
echo "Malformed version number ${VERSION_MM}. Example valid version: 1.9"
exit 1
fi

PIPEYML=$PWD/rc-pipeline.yml
cat << "EOF" | sed -e "s/<VERSION>/${VERSION}/" > $PIPEYML
cat << "EOF" | sed -e "s/<VERSION_MM>/${VERSION_MM}/" > $PIPEYML
---
resources:
- name: geode
type: git
source:
branch: release/<VERSION>
tag_filter: rel/v<VERSION>.RC*
branch: support/<VERSION_MM>
tag_filter: rel/v<VERSION_MM>.*.RC*
uri: https://github.com/apache/geode.git
- name: geode-examples
type: git
source:
branch: release/<VERSION>
branch: support/<VERSION_MM>
uri: https://github.com/apache/geode-examples.git
- name: geode-native
type: git
source:
branch: release/<VERSION>
tag_filter: rel/v<VERSION>.RC*
branch: support/<VERSION_MM>
tag_filter: rel/v<VERSION_MM>.*.RC*
uri: https://github.com/apache/geode-native.git
- name: geode-benchmarks
type: git
source:
branch: release/<VERSION>
tag_filter: rel/v<VERSION>.RC*
branch: support/<VERSION_MM>
tag_filter: rel/v<VERSION_MM>.*.RC*
uri: https://github.com/apache/geode-benchmarks.git
- name: upthewaterspout-tests
type: git
Expand Down Expand Up @@ -469,5 +469,5 @@ jobs:
fi
EOF
fly -t concourse.apachegeode-ci.info-main login --team-name main --concourse-url https://concourse.apachegeode-ci.info/
fly -t concourse.apachegeode-ci.info-main set-pipeline -p apache-release-${VERSION//./-}-rc -c $PIPEYML
fly -t concourse.apachegeode-ci.info-main set-pipeline -p apache-support-${VERSION_MM//./-}-rc -c $PIPEYML
rm $PIPEYML
Loading

0 comments on commit 232cfa1

Please sign in to comment.