jetty.project/scripts/release-jetty.sh
Joakim Erdfelt 65dc704d32
Merge branch 'jetty-9.4.x' into jetty-10.0.x
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

# Conflicts:
#	VERSION.txt
#	aggregates/jetty-all-compact3/pom.xml
#	aggregates/jetty-all/pom.xml
#	apache-jsp/pom.xml
#	apache-jstl/pom.xml
#	build-resources/pom.xml
#	examples/async-rest/async-rest-jar/pom.xml
#	examples/async-rest/async-rest-webapp/pom.xml
#	examples/async-rest/pom.xml
#	examples/embedded/pom.xml
#	examples/pom.xml
#	jetty-alpn/jetty-alpn-client/pom.xml
#	jetty-alpn/jetty-alpn-conscrypt-client/pom.xml
#	jetty-alpn/jetty-alpn-conscrypt-server/pom.xml
#	jetty-alpn/jetty-alpn-java-client/pom.xml
#	jetty-alpn/jetty-alpn-java-server/pom.xml
#	jetty-alpn/jetty-alpn-openjdk8-client/pom.xml
#	jetty-alpn/jetty-alpn-openjdk8-server/pom.xml
#	jetty-alpn/jetty-alpn-server/pom.xml
#	jetty-alpn/pom.xml
#	jetty-annotations/pom.xml
#	jetty-ant/pom.xml
#	jetty-bom/pom.xml
#	jetty-cdi/pom.xml
#	jetty-client/pom.xml
#	jetty-continuation/pom.xml
#	jetty-deploy/pom.xml
#	jetty-distribution/pom.xml
#	jetty-documentation/pom.xml
#	jetty-fcgi/fcgi-client/pom.xml
#	jetty-fcgi/fcgi-server/pom.xml
#	jetty-fcgi/pom.xml
#	jetty-gcloud/jetty-gcloud-session-manager/pom.xml
#	jetty-gcloud/pom.xml
#	jetty-hazelcast/pom.xml
#	jetty-home/pom.xml
#	jetty-http-spi/pom.xml
#	jetty-http/pom.xml
#	jetty-http2/http2-alpn-tests/pom.xml
#	jetty-http2/http2-client/pom.xml
#	jetty-http2/http2-common/pom.xml
#	jetty-http2/http2-hpack/pom.xml
#	jetty-http2/http2-http-client-transport/pom.xml
#	jetty-http2/http2-server/pom.xml
#	jetty-http2/pom.xml
#	jetty-infinispan/infinispan-common/pom.xml
#	jetty-infinispan/infinispan-embedded-query/pom.xml
#	jetty-infinispan/infinispan-embedded/pom.xml
#	jetty-infinispan/infinispan-remote-query/pom.xml
#	jetty-infinispan/infinispan-remote/pom.xml
#	jetty-infinispan/pom.xml
#	jetty-io/pom.xml
#	jetty-jaas/pom.xml
#	jetty-jaspi/pom.xml
#	jetty-jmx/pom.xml
#	jetty-jndi/pom.xml
#	jetty-jspc-maven-plugin/pom.xml
#	jetty-maven-plugin/pom.xml
#	jetty-memcached/jetty-memcached-sessions/pom.xml
#	jetty-memcached/pom.xml
#	jetty-nosql/pom.xml
#	jetty-openid/pom.xml
#	jetty-osgi/jetty-osgi-alpn/pom.xml
#	jetty-osgi/jetty-osgi-boot-jsp/pom.xml
#	jetty-osgi/jetty-osgi-boot-warurl/pom.xml
#	jetty-osgi/jetty-osgi-boot/pom.xml
#	jetty-osgi/jetty-osgi-httpservice/pom.xml
#	jetty-osgi/pom.xml
#	jetty-osgi/test-jetty-osgi-context/pom.xml
#	jetty-osgi/test-jetty-osgi-fragment/pom.xml
#	jetty-osgi/test-jetty-osgi-server/pom.xml
#	jetty-osgi/test-jetty-osgi-webapp/pom.xml
#	jetty-osgi/test-jetty-osgi/pom.xml
#	jetty-plus/pom.xml
#	jetty-proxy/pom.xml
#	jetty-quickstart/pom.xml
#	jetty-rewrite/pom.xml
#	jetty-runner/pom.xml
#	jetty-security/pom.xml
#	jetty-server/pom.xml
#	jetty-servlet/pom.xml
#	jetty-servlets/pom.xml
#	jetty-spring/pom.xml
#	jetty-start/pom.xml
#	jetty-unixsocket/pom.xml
#	jetty-util-ajax/pom.xml
#	jetty-util/pom.xml
#	jetty-webapp/pom.xml
#	jetty-websocket/javax-websocket-client/pom.xml
#	jetty-websocket/javax-websocket-server/pom.xml
#	jetty-websocket/jetty-websocket-api/pom.xml
#	jetty-websocket/jetty-websocket-common/pom.xml
#	jetty-websocket/jetty-websocket-server/pom.xml
#	jetty-websocket/jetty-websocket-tests/pom.xml
#	jetty-websocket/pom.xml
#	jetty-websocket/websocket-core/pom.xml
#	jetty-websocket/websocket-servlet/pom.xml
#	jetty-xml/pom.xml
#	pom.xml
#	tests/jetty-jmh/pom.xml
#	tests/pom.xml
#	tests/test-continuation/pom.xml
#	tests/test-distribution/pom.xml
#	tests/test-http-client-transport/pom.xml
#	tests/test-integration/pom.xml
#	tests/test-jmx/jmx-webapp-it/pom.xml
#	tests/test-jmx/jmx-webapp/pom.xml
#	tests/test-jmx/pom.xml
#	tests/test-loginservice/pom.xml
#	tests/test-quickstart/pom.xml
#	tests/test-sessions/pom.xml
#	tests/test-sessions/test-file-sessions/pom.xml
#	tests/test-sessions/test-gcloud-sessions/pom.xml
#	tests/test-sessions/test-hazelcast-sessions/pom.xml
#	tests/test-sessions/test-infinispan-sessions/pom.xml
#	tests/test-sessions/test-jdbc-sessions/pom.xml
#	tests/test-sessions/test-memcached-sessions/pom.xml
#	tests/test-sessions/test-mongodb-sessions/pom.xml
#	tests/test-sessions/test-sessions-common/pom.xml
#	tests/test-webapps/pom.xml
#	tests/test-webapps/test-cdi-common-webapp/pom.xml
#	tests/test-webapps/test-felix-webapp/pom.xml
#	tests/test-webapps/test-http2-webapp/pom.xml
#	tests/test-webapps/test-jaas-webapp/pom.xml
#	tests/test-webapps/test-jetty-webapp/pom.xml
#	tests/test-webapps/test-jndi-webapp/pom.xml
#	tests/test-webapps/test-mock-resources/pom.xml
#	tests/test-webapps/test-owb-cdi-webapp/pom.xml
#	tests/test-webapps/test-proxy-webapp/pom.xml
#	tests/test-webapps/test-servlet-spec/pom.xml
#	tests/test-webapps/test-servlet-spec/test-container-initializer/pom.xml
#	tests/test-webapps/test-servlet-spec/test-spec-webapp/pom.xml
#	tests/test-webapps/test-servlet-spec/test-web-fragment/pom.xml
#	tests/test-webapps/test-simple-webapp/pom.xml
#	tests/test-webapps/test-webapp-rfc2616/pom.xml
#	tests/test-webapps/test-weld-cdi-webapp/pom.xml
2019-10-24 10:58:45 -05:00

200 lines
6.2 KiB
Bash
Executable File

#!/bin/bash
echo ""
echo "-----------------------------------------------"
echo " Verify Environment"
requiredExecutable() {
hash $1 2>/dev/null
if [ $? != 0 ] ; then
echo "ERROR: $1 not found. Install $1"
exit -1
fi
}
requiredExecutable "git"
requiredExecutable "xmllint"
requiredExecutable "sed"
requiredExecutable "gpg"
requiredExecutable "egrep"
requiredExecutable "mvn"
proceedyn() {
while true; do
read -p "$1 " yn
case ${yn:-$2} in
[Yy]* ) return 0;;
[Nn]* ) return 1;;
* ) echo "Please answer yes or no.";;
esac
done
}
echo ""
echo "-----------------------------------------------"
echo " Collect Information About Release"
function gitFindRemoteByUrl() {
URL="$1"
for GREMOTE in $(git remote); do
git ls-remote --get-url $GREMOTE | grep "$URL" 2>&1 > /dev/null
if [ $? -eq 0 ] ; then
echo $GREMOTE
fi
done
return 0
}
GIT_REMOTE_URL="github.com:eclipse/jetty.project.git"
GIT_REMOTE_ID=$(gitFindRemoteByUrl "$GIT_REMOTE_URL")
GIT_BRANCH_ID=$(git symbolic-ref -q --short HEAD || git describe --tags --exact-match)
if [ -z "$GIT_REMOTE_ID" ] ; then
echo "ERROR: Unable to determine git remote id for $GIT_REMOTE_URL"
echo "Are you running this build from a properly cloned git local repository?"
exit -1
fi
# Ensure that git user is in their gpg key list
GIT_USER_EMAIL=`git config --get user.email`
#gpg -q --list-keys "$GIT_USER_EMAIL" 2>&1 > /dev/null
#if [ $? != 0 ] ; then
# echo "ERROR: git user.email of $GIT_USER_EMAIL is not present in your gpg --list-keys"
# echo "Go ahead and make one $ gpg --gen-key"
# exit -1
#fi
VER_CURRENT=`sed -e "s/xmlns/ignore/" pom.xml | xmllint --xpath "/project/version/text()" -`
echo "Current pom.xml Version: ${VER_CURRENT}"
read -e -p "Release Version ? " VER_RELEASE
read -e -p "Next Dev Version ? " VER_NEXT
TAG_NAME="jetty-$VER_RELEASE"
# Ensure tag doesn't exist (yet)
git rev-parse --quiet --verify "$TAG_NAME" 2>&1 > /dev/null
if [ $? -eq 0 ] ; then
echo ""
echo "ERROR: Git Tag $TAG_NAME already exists"
echo ""
git show -s "$TAG_NAME"
exit -1
fi
ALT_DEPLOY_DIR=$HOME/.m2/alt-deploy
if [ ! -d "$ALT_DEPLOY_DIR" ] ; then
mkdir -p "$ALT_DEPLOY_DIR"
fi
# DEPLOY_OPTS="-Dmaven.test.failure.ignore=true"
DEPLOY_OPTS="-DskipTests -Dtest=None"
# DEPLOY_OPTS="$DEPLOY_OPTS -DaltDeploymentRepository=intarget::default::file://$ALT_DEPLOY_DIR/"
# Uncomment for Java 1.7
export MAVEN_OPTS="-Xmx1g -XX:MaxPermSize=128m"
echo ""
echo "-----------------------------------------------"
echo " Release Plan Review"
echo ""
echo "Git Remote ID : $GIT_REMOTE_ID"
echo "Git Branch ID : $GIT_BRANCH_ID"
echo "Git user.email : $GIT_USER_EMAIL"
echo "Current Version : $VER_CURRENT"
echo "Release Version : $VER_RELEASE"
echo "Next Dev Version : $VER_NEXT"
echo "Tag name : $TAG_NAME"
echo "MAVEN_OPTS : $MAVEN_OPTS"
echo "Maven Deploy Opts: $DEPLOY_OPTS"
reportMavenTestFailures() {
failFiles=$(egrep -lr --include="*.txt" -E "^Tests .* FAILURE" .)
oldIFS="$IFS"
IFS='
'
IFS=${IFS:0:1}
failarray=( $failFiles )
IFS="$oldIFS"
for index in ${!failarray[@]}; do
echo ${failarray[index]}
cat ${failarray[index]}
done
if [ ${#failarray[@]} -gt 0 ] ; then
echo "There are ${#failarray[@]} Test Cases with failures"
else
echo "There are no testcases with failures"
fi
}
echo ""
if proceedyn "Are you sure you want to release using above? (y/N)" n; then
echo ""
if proceedyn "Update VERSION.txt for $VER_RELEASE? (Y/n)" y; then
# Uncomment alternate JVM for jetty 9.2 builds
# JAVA_HOME_ORIG=$JAVA_HOME
# PATH_ORIG=$PATH
# JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
# PATH=$JAVA_HOME/bin:$PATH
mvn -N -Pupdate-version generate-resources
cp VERSION.txt VERSION.txt.backup
cat VERSION.txt.backup | sed -e "s/$VER_CURRENT/$VER_RELEASE/" > VERSION.txt
rm VERSION.txt.backup
# JAVA_HOME=$JAVA_HOME_ORIG
# PATH=$PATH_ORIG
echo "VERIFY the following files (in a different console window) before continuing."
echo " VERSION.txt - top section"
echo " target/version-tag.txt - for the tag commit message"
fi
# This is equivalent to 'mvn release:prepare'
if proceedyn "Update project.versions for $VER_RELEASE? (Y/n)" y; then
mvn org.codehaus.mojo:versions-maven-plugin:2.7:set \
-DoldVersion="$VER_CURRENT" \
-DnewVersion="$VER_RELEASE" \
-DprocessAllModules=true
fi
if proceedyn "Commit $VER_RELEASE updates? (Y/n)" y; then
git commit -a -m "Updating to version $VER_RELEASE"
fi
if proceedyn "Create Tag $TAG_NAME? (Y/n)" y; then
echo "TODO: Sign tags with GIT_USER_EMAIL=$GIT_USER_EMAIL"
echo "Using target/version-tag.txt as tag text"
git tag --file=target/version-tag.txt $TAG_NAME
fi
# This is equivalent to 'mvn release:perform'
if proceedyn "Build/Deploy from tag $TAG_NAME? (Y/n)" y; then
git checkout $TAG_NAME
mvn clean package source:jar javadoc:jar gpg:sign deploy \
-Peclipse-release $DEPLOY_OPTS
reportMavenTestFailures
git checkout $GIT_BRANCH_ID
fi
if proceedyn "Update working directory for $VER_NEXT? (Y/n)" y; then
echo "Update VERSION.txt for $VER_NEXT"
cp VERSION.txt VERSION.txt.backup
echo "jetty-$VER_NEXT" > VERSION.txt
echo "" >> VERSION.txt
cat VERSION.txt.backup >> VERSION.txt
echo "Update project.versions for $VER_NEXT"
mvn org.codehaus.mojo:versions-maven-plugin:2.7:set \
-DoldVersion="$VER_RELEASE" \
-DnewVersion="$VER_NEXT" \
-DprocessAllModules=true
echo "Commit $VER_NEXT"
if proceedyn "Commit updates in working directory for $VER_NEXT? (Y/n)" y; then
git commit -a -m "Updating to version $VER_NEXT"
fi
fi
if proceedyn "Push git commits to remote $GIT_REMOTE_ID? (Y/n)" y; then
git push $GIT_REMOTE_ID $GIT_BRANCH_ID
git push $GIT_REMOTE_ID $TAG_NAME
fi
else
echo "Not performing release"
fi