publish_release.sh | 12 -
release.sh | 432 +++++++++++++++++++++--------------------------------
rhq_bash.lib | 28 +++
3 files changed, 205 insertions(+), 267 deletions(-)
New commits:
commit 2aa9a9acd4f4db0a8346041918740b57989f7b29
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Sep 29 16:32:27 2011 -0500
Abort the script if local or remote tags already exist. This should never happen
regardless of the script mode.
diff --git a/release.sh b/release.sh
index 5d598ed..629e30f 100755
--- a/release.sh
+++ b/release.sh
@@ -259,22 +259,14 @@ fi
# If the specified tag already exists remotely and we're in production mode, then
abort. If it exists and
# we're in test mode, delete it
EXISTING_REMOTE_TAG=`git ls-remote --tags origin "$RELEASE_TAG"`
-if [ -n "$EXISTING_REMOTE_TAG" ] && [ "$MODE" =
"production" ]; then
- abort "A remote tag named $RELEASE_TAG already exists - aborting, since we are in
production mode..."
-fi
-
-if [ -n "$EXISTING_REMOTE_TAG" ] && [ "$MODE" =
"test" ]; then
- echo "A remote tag named $RELEASE_TAG already exists - deleting it, since we are
in test mode..."
- git push origin ":refs/tags/$RELEASE_TAG"
- [ "$?" -ne 0 ] && abort "Failed to delete remote tag
($RELEASE_TAG)."
+if [ -n "$EXISTING_REMOTE_TAG" ] then
+ abort "A remote tag named $RELEASE_TAG already exists - aborting"
fi
# See if the specified tag already exists locally - if so, delete it (even if in
production mode).
EXISTING_LOCAL_TAG=`git tag -l "$RELEASE_TAG"`
if [ -n "$EXISTING_LOCAL_TAG" ]; then
- echo "A local tag named $RELEASE_TAG already exists - deleting it..."
- git tag -d "$RELEASE_TAG"
- [ "$?" -ne 0 ] && abort "Failed to delete local tag
($RELEASE_TAG)."
+ abort "A local tag named $RELEASE_TAG already exists - aborting"
fi
run_versioning_process
commit ed45d1efe4fe62b80be813b7c7f81a4923cacf2f
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Sep 29 16:20:07 2011 -0500
Introduce the concept of script mode and add it to the command line arguments.
diff --git a/release.sh b/release.sh
index 17be5b2..5d598ed 100755
--- a/release.sh
+++ b/release.sh
@@ -31,37 +31,31 @@ abort()
#===================================================================================
usage()
{
- abort "$@" "Usage: $EXE community|enterprise RELEASE_VERSION
DEVELOPMENT_VERSION RELEASE_BRANCH GIT_USERNAME test|production" "Example: $EXE
enterprise 3.0.0.GA 3.0.0-SNAPSHOT release-3.0.0 ips test"
+ abort "$@" "Usage: $EXE branch|tag community|enterprise
RELEASE_VERSION DEVELOPMENT_VERSION RELEASE_BRANCH GIT_USERNAME test|production"
"Example: $EXE enterprise 3.0.0.GA 3.0.0-SNAPSHOT release-3.0.0 ips test"
}
-#===================================================================================
-# Description: Set all the local and environment variables required by the script.
-#===================================================================================
-set_variables()
-{
- # Constants
-
- PROJECT_NAME="rhq"
- PROJECT_DISPLAY_NAME="RHQ"
-
PROJECT_GIT_WEB_URL="http://git.fedorahosted.org/git/?p=rhq/rhq.git&...
- TAG_PREFIX="RHQ"
- MINIMUM_MAVEN_VERSION="2.1.0"
+validate_arguments()
+{
# Process command line args.
EXE=`basename $0`
- if [ "$#" -ne 6 ]; then
+ if [ "$#" -ne 7 ]; then
usage
- fi
- RELEASE_TYPE="$1"
+ fi
+
+ SCRIPT_MODE="$1"
+
+ RELEASE_TYPE="$2"
if [ "$RELEASE_TYPE" != "community" ] && [
"$RELEASE_TYPE" != "enterprise" ]; then
usage "Invalid release type: $RELEASE_TYPE (valid release types are
'community' or 'enterprise')"
fi
- RELEASE_VERSION="$2"
- DEVELOPMENT_VERSION="$3"
- RELEASE_BRANCH="$4"
- GIT_USERNAME="$5"
- MODE="$6"
+ RELEASE_VERSION="$3"
+ DEVELOPMENT_VERSION="$4"
+ RELEASE_BRANCH="$5"
+ GIT_USERNAME="$6"
+ MODE="$7"
+
if [ "$MODE" != "test" ] && [ "$MODE" !=
"production" ]; then
usage "Invalid mode: $MODE (valid modes are 'test' or
'production')"
fi
@@ -71,13 +65,26 @@ set_variables()
usage "In production mode,
jboss.org credentials must be specified via the
JBOSS_ORG_USERNAME and JBOSS_ORG_PASSWORD environment variables."
fi
fi
+}
+
+#===================================================================================
+# Description: Set all the local and environment variables required by the script.
+#===================================================================================
+set_variables()
+{
+ # Constants
+
+ PROJECT_NAME="rhq"
+ PROJECT_DISPLAY_NAME="RHQ"
+
PROJECT_GIT_WEB_URL="http://git.fedorahosted.org/git/?p=rhq/rhq.git&...
+ TAG_PREFIX="RHQ"
+ MINIMUM_MAVEN_VERSION="2.1.0"
# Set various environment variables.
MAVEN_OPTS="-Xms512M -Xmx1024M -XX:PermSize=128M -XX:MaxPermSize=256M"
export MAVEN_OPTS
-
# Set various local variables.
if [ -n "$HUDSON_URL" ] && [ -n "$WORKSPACE" ]; then
@@ -167,6 +174,8 @@ fi
# TODO: Check that JDK version is < 1.7.
+validate_arguments $@
+
validate_java_6
validate_java_5
@@ -175,7 +184,7 @@ validate_maven
validate_git
-set_variables $@
+set_variables
# Print out a summary of the environment.
print_centered "Environment Variables"
commit 9aa53e6a0538815a47846901fe5b46bca5f1ad5b
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Sep 29 15:49:02 2011 -0500
Added documentation for existing functions. Also, done a little refactoring to make
the main script more legible.
diff --git a/release.sh b/release.sh
index 5a4bf7f..17be5b2 100755
--- a/release.sh
+++ b/release.sh
@@ -1,9 +1,22 @@
-#!/bin/sh
-
+#!/bin/bash
+#===================================================================================
+#
+# Usage: release.sh community|enterprise RELEASE_VERSION DEVELOPMENT_VERSION
RELEASE_BRANCH GIT_USERNAME test|production
+#
+# Description:
+# Add description here
+#
+# Options:
+# Add option description here
+#===================================================================================
+
+#include the utility library
source `dirname $0`/rhq_bash.lib
-# Functions
+#===================================================================================
+# Description: Display an error message and abort the script.
+#===================================================================================
abort()
{
echo >&2
@@ -13,11 +26,17 @@ abort()
exit 1
}
+#===================================================================================
+# Description: Display usage information then abort the script.
+#===================================================================================
usage()
{
abort "$@" "Usage: $EXE community|enterprise RELEASE_VERSION
DEVELOPMENT_VERSION RELEASE_BRANCH GIT_USERNAME test|production" "Example: $EXE
enterprise 3.0.0.GA 3.0.0-SNAPSHOT release-3.0.0 ips test"
}
+#===================================================================================
+# Description: Set all the local and environment variables required by the script.
+#===================================================================================
set_variables()
{
# Constants
@@ -113,6 +132,10 @@ set_variables()
export LANG
}
+#===================================================================================
+# Description: Perform version update process and test the outcome by building
+# from source.
+#===================================================================================
run_versioning_process()
{
# Clean up the snapshot jars produced by the test build from module target dirs.
@@ -152,15 +175,15 @@ validate_maven
validate_git
-set_variables
+set_variables $@
# Print out a summary of the environment.
-echo "========================== Environment Variables
=============================="
+print_centered "Environment Variables"
environment_variables=("JAVA_HOME" "M2_HOME" "MAVEN_OPTS"
"PATH" "LANG" "RELEASE_TYPE")
print_variables "${environment_variables[@]}"
-echo "============================= Local Variables
================================="
+print_centered "Local Variables"
local_variables=("WORKING_DIR" "PROJECT_NAME"
"PROJECT_GIT_URL" "RELEASE_TYPE" "DEVELOPMENT_VERSION" \
"RELEASE_BRANCH" "MODE"
"MAVEN_LOCAL_REPO_DIR" \
"MAVEN_SETTINGS_FILE" "MAVEN_ARGS"
"MAVEN_RELEASE_PERFORM_GOAL" "JBOSS_ORG_USERNAME" \
@@ -168,11 +191,13 @@ local_variables=("WORKING_DIR" "PROJECT_NAME"
"PROJECT_GIT_URL" "RELEASE_TYPE" "
print_variables "${local_variables[@]}"
-echo "============================= Program Versions
================================"
+print_centered "Program Versions"
program_versions=("git --version" "java -version" "mvn
--version")
print_program_versions "${program_versions[@]}"
-echo
"==============================================================================="
+print_centered "="
+
+exit
# Checkout the source from git, assume that the git repo is already cloned
git status >/dev/null 2>&1
@@ -221,14 +246,9 @@ else
git pull origin "$BUILD_BRANCH"
git push origin "$BUILD_BRANCH"
fi
-
-
-# We should now have the build_branch checked out
-echo "Current Branch is $BUILD_BRANCH"
# If the specified tag already exists remotely and we're in production mode, then
abort. If it exists and
# we're in test mode, delete it
-
EXISTING_REMOTE_TAG=`git ls-remote --tags origin "$RELEASE_TAG"`
if [ -n "$EXISTING_REMOTE_TAG" ] && [ "$MODE" =
"production" ]; then
abort "A remote tag named $RELEASE_TAG already exists - aborting, since we are in
production mode..."
@@ -240,7 +260,6 @@ if [ -n "$EXISTING_REMOTE_TAG" ] && [
"$MODE" = "test" ]; then
[ "$?" -ne 0 ] && abort "Failed to delete remote tag
($RELEASE_TAG)."
fi
-
# See if the specified tag already exists locally - if so, delete it (even if in
production mode).
EXISTING_LOCAL_TAG=`git tag -l "$RELEASE_TAG"`
if [ -n "$EXISTING_LOCAL_TAG" ]; then
diff --git a/rhq_bash.lib b/rhq_bash.lib
index 19d76da..7c1229b 100644
--- a/rhq_bash.lib
+++ b/rhq_bash.lib
@@ -132,3 +132,31 @@ validate_git()
abort "Unsupported git version - $GIT_VERSION. Only git 1.6.x or 1.7.x are
supported. Please add a directory containing a supported version of git to your PATH, then
try again."
fi
}
+
+print_centered()
+{
+ max_length=90
+ string_length=${#1}
+
+ if [ $string_length -ge `expr $max_length - 2` ]
+ then
+ echo $1
+ return 0
+ fi
+
+ left_side=`expr $max_length - $string_length`
+ left_side=`expr $left_side / 2`
+
+ is_odd_number=$(( $string_length % 2 ))
+ if [ $is_odd_number -eq 0 ]
+ then
+ right_side=$left_side
+ else
+ right_side=`expr $left_side + 1 `
+ fi
+
+ eval "printf '=%.0s' {1..${left_side}}"
+ printf " $1 "
+ eval "printf '=%.0s' {1..${right_side}}"
+ printf "\n"
+}
commit 942491f72ee57adf050255febd589775af94d45f
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Sep 29 14:35:38 2011 -0500
Replace maven release plugin with versions plugin. Also removed all the code that will
not be use going forward.
diff --git a/release.sh b/release.sh
index b3491ad..5a4bf7f 100755
--- a/release.sh
+++ b/release.sh
@@ -113,6 +113,30 @@ set_variables()
export LANG
}
+run_versioning_process()
+{
+ # Clean up the snapshot jars produced by the test build from module target dirs.
+ echo "Cleaning up snapshot jars produced by test build from module target
dirs..."
+ mvn clean $MAVEN_ARGS
+ [ "$?" -ne 0 ] && abort "Failed to cleanup snbapshot jars
produced by test build from module target dirs. Please see above Maven output for details,
fix any issues, then try again."
+
+ mvn install $MAVEN_ARGS -Ddbreset
+ [ "$?" -ne 0 ] && abort "Test build failed. Please see output
for details, fix any issues, then try again."
+
+ mvn versions:set versions:use-releases -DnewVersion=$RELEASE_VERSION
-DallowSnapshots=false -DgenerateBackupPoms=false
+ [ "$?" -ne 0 ] && abort "Version set failed. Please see output
for details, fix any issues, then try again."
+
+ mvn install $MAVEN_ARGS -DskipTests=true -Ddbsetup-do-not-check-schema=true
+ [ "$?" -ne 0 ] && abort "Maven build for new version failed.
Please see output for details, fix any issues, then try again."
+
+ mvn versions:set versions:use-releases -DnewVersion=$DEVELOPMENT_VERSION
-DallowSnapshots=false -DgenerateBackupPoms=false
+ [ "$?" -ne 0 ] && abort "Version set failed. Please see output
for details, fix any issues, then try again."
+
+ #echo "Building release from tag and publishing Maven artifacts (this will take
about 10-15 minutes)..."
+ #mvn $MAVEN_RELEASE_PERFORM_GOAL $MAVEN_ARGS -Dmaven.test.skip=true
-Ddbsetup-do-not-check-schema=true
+ #[ "$?" -ne 0 ] && abort "Release build failed. Please see
above Maven output for details, fix any issues, then try again."
+}
+
if [ -n "$RELEASE_DEBUG" ]; then
echo "Debug output is enabled."
set -x
@@ -144,7 +168,6 @@ local_variables=("WORKING_DIR" "PROJECT_NAME"
"PROJECT_GIT_URL" "RELEASE_TYPE" "
print_variables "${local_variables[@]}"
-
echo "============================= Program Versions
================================"
program_versions=("git --version" "java -version" "mvn
--version")
print_program_versions "${program_versions[@]}"
@@ -219,67 +242,14 @@ fi
# See if the specified tag already exists locally - if so, delete it (even if in
production mode).
-
EXISTING_LOCAL_TAG=`git tag -l "$RELEASE_TAG"`
if [ -n "$EXISTING_LOCAL_TAG" ]; then
echo "A local tag named $RELEASE_TAG already exists - deleting it..."
git tag -d "$RELEASE_TAG"
[ "$?" -ne 0 ] && abort "Failed to delete local tag
($RELEASE_TAG)."
fi
-
-# Run a test build before tagging. This will publish the snapshot artifacts to the local
repo to "bootstrap" the repo.
-
-#echo "Building project to ensure tests pass and to bootstrap local Maven repo (this
will take about 15-30 minutes)..."
-# NOTE: There is no need to do a mvn clean below, since we just did either a clone or
clean checkout above.
-#mvn install $MAVEN_ARGS -Ddbreset
-#[ "$?" -ne 0 ] && abort "Test build failed. Please see above
Maven output for details, fix any issues, then try again."
-#echo
-#echo "Test build succeeded!"
-
-
-# Clean up the snapshot jars produced by the test build from module target dirs.
-
-echo "Cleaning up snapshot jars produced by test build from module target
dirs..."
-mvn clean $MAVEN_ARGS
-[ "$?" -ne 0 ] && abort "Failed to cleanup snbapshot jars produced
by test build from module target dirs. Please see above Maven output for details, fix any
issues, then try again."
-
-
-# If this is a production build perform a dry run of tagging the release. Skip this for
test builds to reduce the
-# build time
-
-if [ "$MODE" = "todo" ]; then
- echo "Doing a dry run of tagging the release..."
- mvn release:prepare $MAVEN_ARGS -DreleaseVersion=$RELEASE_VERSION
-DdevelopmentVersion=$DEVELOPMENT_VERSION -Dresume=false -Dtag=$RELEASE_TAG
"-DpreparationGoals=install $MAVEN_ARGS -DskipTests=true
-Ddbsetup-do-not-check-schema=true" -DdryRun=true
- [ "$?" -ne 0 ] && abort "Tagging dry run failed. Please see
above Maven output for details, fix any issues, then try again."
- mvn release:clean $MAVEN_ARGS
- [ "$?" -ne 0 ] && abort "Failed to cleanup release plugin
working files from tagging dry run. Please see above Maven output for details, fix any
issues, then try again."
- echo
- echo "Tagging dry run succeeded!"
-fi
-
-
-# If the dry run was skipped or succeeded, tag it for real.
-
-echo "Tagging the release..."
-mvn release:prepare $MAVEN_ARGS -DreleaseVersion=$RELEASE_VERSION
-DdevelopmentVersion=$DEVELOPMENT_VERSION -Dresume=false -Dtag=$RELEASE_TAG
"-DpreparationGoals=install $MAVEN_ARGS -DskipTests=true
-Ddbsetup-do-not-check-schema=true" -DdryRun=false -Dusername=$GIT_USERNAME
-[ "$?" -ne 0 ] && abort "Tagging failed. Please see above Maven
output for details, fix any issues, then try again."
-echo
-echo "Tagging succeeded!"
-
-
-# Checkout the tag and build it. If in production mode, publish the Maven artifacts.
-
-#echo "Checking out release tag $RELEASE_TAG..."
-#git checkout "$RELEASE_TAG"
-#[ "$?" -ne 0 ] && abort "Checkout of release tag ($RELEASE_TAG)
failed. Please see above git output for details, fix any issues, then try again."
-#git clean -dxf
-#[ "$?" -ne 0 ] && abort "Failed to cleanup unversioned files.
Please see above git output for details, fix any issues, then try again."
-#echo "Building release from tag and publishing Maven artifacts (this will take
about 10-15 minutes)..."
-#mvn $MAVEN_RELEASE_PERFORM_GOAL $MAVEN_ARGS -Dmaven.test.skip=true
-Ddbsetup-do-not-check-schema=true
-#[ "$?" -ne 0 ] && abort "Release build failed. Please see above
Maven output for details, fix any issues, then try again."
-#echo
-#echo "Release build succeeded!"
+run_versioning_process
echo
echo "=============================== Release Info
=================================="
commit 178abf75353d1932d4d1c7f6d75f4e9dd261ab11
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Sep 28 14:43:29 2011 -0500
Update the git script to function on the assumption that the current folder is a git
folder and the folder to build from.
diff --git a/release.sh b/release.sh
index 2f583c9..b3491ad 100755
--- a/release.sh
+++ b/release.sh
@@ -151,36 +151,30 @@ print_program_versions "${program_versions[@]}"
echo
"==============================================================================="
-# Clone and/or checkout the source from git.
-
-if [ -d "$WORKING_DIR" ]; then
- cd "$WORKING_DIR"
- git status >/dev/null 2>&1
- GIT_STATUS_EXIT_CODE=$?
- # Note, git 1.6 and earlier returns an exit code of 1, rather than 0, if there are any
uncommitted changes,
- # and git 1.7 returns 0, so we check if the exit code is less than or equal to 1 to
determine if $WORKING_DIR
- # is truly a git working copy.
- if [ "$GIT_STATUS_EXIT_CODE" -le 1 ]; then
- echo "Checking out a clean copy of the release branch
($RELEASE_BRANCH)..."
- git fetch origin "$RELEASE_BRANCH"
- [ "$?" -ne 0 ] && abort "Failed to fetch release branch
($RELEASE_BRANCH)."
- git checkout "$RELEASE_BRANCH" 2>/dev/null
- if [ "$?" -ne 0 ]; then
- git checkout --track -b "$RELEASE_BRANCH"
"origin/$RELEASE_BRANCH"
- fi
- [ "$?" -ne 0 ] && abort "Failed to checkout release branch
($RELEASE_BRANCH)."
- git reset --hard "origin/$RELEASE_BRANCH"
- [ "$?" -ne 0 ] && abort "Failed to reset release branch
($RELEASE_BRANCH)."
- git clean -dxf
- [ "$?" -ne 0 ] && abort "Failed to clean release branch
($RELEASE_BRANCH)."
- git pull
- [ "$?" -ne 0 ] && abort "Failed to update release branch
($RELEASE_BRANCH)."
- else
- echo "$WORKING_DIR does not appear to be a git working directory ('git
status' returned $GIT_STATUS_EXIT_CODE) - removing it so we can freshly clone the
repo..."
- cd ..
- rm -rf "$WORKING_DIR"
- [ "$?" -ne 0 ] && abort "Failed to remove bogus working
directory ($WORKING_DIR)."
- fi
+# Checkout the source from git, assume that the git repo is already cloned
+git status >/dev/null 2>&1
+GIT_STATUS_EXIT_CODE=$?
+# Note, git 1.6 and earlier returns an exit code of 1, rather than 0, if there are any
uncommitted changes,
+# and git 1.7 returns 0, so we check if the exit code is less than or equal to 1 to
determine if $WORKING_DIR
+# is truly a git working copy.
+if [ "$GIT_STATUS_EXIT_CODE" -le 1 ]; then
+ echo "Checking out a clean copy of the release branch
($RELEASE_BRANCH)..."
+ git fetch origin "$RELEASE_BRANCH"
+ [ "$?" -ne 0 ] && abort "Failed to fetch release branch
($RELEASE_BRANCH)."
+
+ git checkout "$RELEASE_BRANCH" 2>/dev/null
+ if [ "$?" -ne 0 ]; then
+ git checkout --track -b "$RELEASE_BRANCH"
"origin/$RELEASE_BRANCH"
+ fi
+ [ "$?" -ne 0 ] && abort "Failed to checkout release branch
($RELEASE_BRANCH)."
+ git reset --hard "origin/$RELEASE_BRANCH"
+ [ "$?" -ne 0 ] && abort "Failed to reset release branch
($RELEASE_BRANCH)."
+ git clean -dxf
+ [ "$?" -ne 0 ] && abort "Failed to clean release branch
($RELEASE_BRANCH)."
+ git pull
+ [ "$?" -ne 0 ] && abort "Failed to update release branch
($RELEASE_BRANCH)."
+else
+ echo "$WORKING_DIR does not appear to be a git working directory ('git
status' returned $GIT_STATUS_EXIT_CODE) - removing it so we can freshly clone the
repo..."
fi
# if this is a test build then create a temporary build branch off of RELEASE_BRANCH.
This allows checkins to
@@ -293,4 +287,3 @@ echo "Version: $RELEASE_VERSION"
echo "Branch URL:
$PROJECT_GIT_WEB_URL;a=shortlog;h=refs/heads/$RELEASE_BRANCH"
echo "Tag URL: $PROJECT_GIT_WEB_URL;a=shortlog;h=refs/tags/$RELEASE_TAG"
echo
"==============================================================================="
-
commit dea54207756c9b17722e8770518760a326f06a1d
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Sep 28 14:32:28 2011 -0500
Removed the git cloning option from the scripts. The scripts do not exist unless the
git repo was already cloned.
diff --git a/publish_release.sh b/publish_release.sh
index 3141102..fc696b0 100755
--- a/publish_release.sh
+++ b/publish_release.sh
@@ -2,7 +2,6 @@
source `dirname $0`/rhq_bash.lib
-
# Functions
abort()
@@ -182,17 +181,6 @@ if [ ! "$HUDSON_URL" ]; then
[ "$?" -ne 0 ] && abort "Failed to remove bogus
working directory ($WORKING_DIR)."
fi
fi
-
- if [ ! -d "$WORKING_DIR" ]; then
- echo "Cloning the $PROJECT_NAME git repo (this will take about 10-15
minutes)..."
- git clone "$PROJECT_GIT_URL" "$WORKING_DIR"
- [ "$?" -ne 0 ] && abort "Failed to clone $PROJECT_NAME git
repo ($PROJECT_GIT_URL)."
- cd "$WORKING_DIR"
- if [ "$RELEASE_BRANCH" != "master" ]; then
- git checkout --track -b $RELEASE_BRANCH "origin/$RELEASE_BRANCH"
- fi
- [ "$?" -ne 0 ] && abort "Failed to checkout release branch
($RELEASE_BRANCH)."
- fi
fi
diff --git a/release.sh b/release.sh
index 43fef6a..2f583c9 100755
--- a/release.sh
+++ b/release.sh
@@ -28,7 +28,6 @@ set_variables()
TAG_PREFIX="RHQ"
MINIMUM_MAVEN_VERSION="2.1.0"
-
# Process command line args.
EXE=`basename $0`
@@ -183,17 +182,6 @@ if [ -d "$WORKING_DIR" ]; then
[ "$?" -ne 0 ] && abort "Failed to remove bogus working
directory ($WORKING_DIR)."
fi
fi
-if [ ! -d "$WORKING_DIR" ]; then
- echo "Cloning the $PROJECT_NAME git repo (this will take about 10-15
minutes)..."
- git clone "$PROJECT_GIT_URL" "$WORKING_DIR"
- [ "$?" -ne 0 ] && abort "Failed to clone $PROJECT_NAME git repo
($PROJECT_GIT_URL)."
- cd "$CLONE_DIR"
- if [ "$RELEASE_BRANCH" != "master" ]; then
- git checkout --track -b $RELEASE_BRANCH "origin/$RELEASE_BRANCH"
- fi
- [ "$?" -ne 0 ] && abort "Failed to checkout release branch
($RELEASE_BRANCH)."
-fi
-
# if this is a test build then create a temporary build branch off of RELEASE_BRANCH.
This allows checkins to
# continue in RELEASE_BRANCH without affecting the release plugin work, which will fail
if the branch contents
commit d1cf02447bccf23b270a21fe5acfe94f9393a4d2
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Sep 28 13:33:26 2011 -0500
Move environment setup in a function to make the code more readable.
diff --git a/release.sh b/release.sh
index b64d762..43fef6a 100755
--- a/release.sh
+++ b/release.sh
@@ -18,117 +18,118 @@ usage()
abort "$@" "Usage: $EXE community|enterprise RELEASE_VERSION
DEVELOPMENT_VERSION RELEASE_BRANCH GIT_USERNAME test|production" "Example: $EXE
enterprise 3.0.0.GA 3.0.0-SNAPSHOT release-3.0.0 ips test"
}
+set_variables()
+{
+ # Constants
-if [ -n "$RELEASE_DEBUG" ]; then
- echo "Debug output is enabled."
- set -x
-fi
-
-
-# Constants
-
-PROJECT_NAME="rhq"
-PROJECT_DISPLAY_NAME="RHQ"
-PROJECT_GIT_WEB_URL="http://git.fedorahosted.org/git/?p=rhq/rhq.git"
-TAG_PREFIX="RHQ"
-MINIMUM_MAVEN_VERSION="2.1.0"
+ PROJECT_NAME="rhq"
+ PROJECT_DISPLAY_NAME="RHQ"
+
PROJECT_GIT_WEB_URL="http://git.fedorahosted.org/git/?p=rhq/rhq.git&...
+ TAG_PREFIX="RHQ"
+ MINIMUM_MAVEN_VERSION="2.1.0"
-# Process command line args.
+ # Process command line args.
-EXE=`basename $0`
-if [ "$#" -ne 6 ]; then
- usage
-fi
-RELEASE_TYPE="$1"
-if [ "$RELEASE_TYPE" != "community" ] && [
"$RELEASE_TYPE" != "enterprise" ]; then
- usage "Invalid release type: $RELEASE_TYPE (valid release types are
'community' or 'enterprise')"
-fi
-RELEASE_VERSION="$2"
-DEVELOPMENT_VERSION="$3"
-RELEASE_BRANCH="$4"
-GIT_USERNAME="$5"
-MODE="$6"
-if [ "$MODE" != "test" ] && [ "$MODE" !=
"production" ]; then
- usage "Invalid mode: $MODE (valid modes are 'test' or
'production')"
-fi
+ EXE=`basename $0`
+ if [ "$#" -ne 6 ]; then
+ usage
+ fi
+ RELEASE_TYPE="$1"
+ if [ "$RELEASE_TYPE" != "community" ] && [
"$RELEASE_TYPE" != "enterprise" ]; then
+ usage "Invalid release type: $RELEASE_TYPE (valid release types are
'community' or 'enterprise')"
+ fi
+ RELEASE_VERSION="$2"
+ DEVELOPMENT_VERSION="$3"
+ RELEASE_BRANCH="$4"
+ GIT_USERNAME="$5"
+ MODE="$6"
+ if [ "$MODE" != "test" ] && [ "$MODE" !=
"production" ]; then
+ usage "Invalid mode: $MODE (valid modes are 'test' or
'production')"
+ fi
-if [ "$MODE" = "production" ]; then
- if [ -z "$JBOSS_ORG_USERNAME" ] || [ -z "$JBOSS_ORG_PASSWORD" ];
then
- usage "In production mode,
jboss.org credentials must be specified via the
JBOSS_ORG_USERNAME and JBOSS_ORG_PASSWORD environment variables."
- fi
-fi
+ if [ "$MODE" = "production" ]; then
+ if [ -z "$JBOSS_ORG_USERNAME" ] || [ -z "$JBOSS_ORG_PASSWORD"
]; then
+ usage "In production mode,
jboss.org credentials must be specified via the
JBOSS_ORG_USERNAME and JBOSS_ORG_PASSWORD environment variables."
+ fi
+ fi
-# TODO: Check that JDK version is < 1.7.
+ # Set various environment variables.
-validate_java_6
+ MAVEN_OPTS="-Xms512M -Xmx1024M -XX:PermSize=128M -XX:MaxPermSize=256M"
+ export MAVEN_OPTS
-validate_java_5
-validate_maven
+ # Set various local variables.
-validate_git
+ if [ -n "$HUDSON_URL" ] && [ -n "$WORKSPACE" ]; then
+ echo "We appear to be running in a Hudson job."
+ WORKING_DIR="$WORKSPACE"
+ MAVEN_LOCAL_REPO_DIR="$HOME/.m2/hudson-release-$RELEASE_TYPE-repository"
+ MAVEN_SETTINGS_FILE="$HOME/.m2/hudson-$JOB_NAME-settings.xml"
+ elif [ -z "$WORKING_DIR" ]; then
+ WORKING_DIR="$HOME/release/rhq"
+ # MAVEN_LOCAL_REPO_DIR="$HOME/release/m2-repository"
+ MAVEN_LOCAL_REPO_DIR="$HOME/.m2/repository"
+ MAVEN_SETTINGS_FILE="$HOME/release/m2-settings.xml"
+ fi
+
PROJECT_GIT_URL="ssh://${GIT_USERNAME}@git.fedorahosted.org/git/rhq/rhq.git"
+
+ MAVEN_ARGS="--settings $MAVEN_SETTINGS_FILE --batch-mode --errors
-Penterprise,dist,release"
+ # TODO: We may eventually want to reenable tests for production releases.
+ #if [ "$MODE" = "test" ]; then
+ # MAVEN_ARGS="$MAVEN_ARGS -DskipTests=true"
+ #fi
+ MAVEN_ARGS="$MAVEN_ARGS -DskipTests=true"
+ if [ "$RELEASE_TYPE" = "enterprise" ]; then
+ MAVEN_ARGS="$MAVEN_ARGS -Dexclude-webdav "
+ #MAVEN_ARGS="$MAVEN_ARGS -Dexclude-webdav -Djava5.home=$JAVA5_HOME/jre"
+ fi
+ if [ -n "$RELEASE_DEBUG" ]; then
+ MAVEN_ARGS="$MAVEN_ARGS --debug"
+ fi
+ if [ -n "$RELEASE_ADDITIONAL_MAVEN_ARGS" ]; then
+ MAVEN_ARGS="$MAVEN_ARGS $RELEASE_ADDITIONAL_MAVEN_ARGS"
+ fi
-# Set various environment variables.
+ # TODO: We may eventually want to reenable publishing of enterprise artifacts.
+ #if [ "$MODE" = "production" ] && [
"$RELEASE_TYPE" = "community" ]; then
+ # MAVEN_RELEASE_PERFORM_GOAL="deploy"
+ #else
+ MAVEN_RELEASE_PERFORM_GOAL="install"
+ #fi
-MAVEN_OPTS="-Xms512M -Xmx1024M -XX:PermSize=128M -XX:MaxPermSize=256M"
-export MAVEN_OPTS
+ TAG_VERSION=`echo $RELEASE_VERSION | sed 's/\./_/g'`
+ RELEASE_TAG="${TAG_PREFIX}_${TAG_VERSION}"
-# Set various local variables.
-if [ -n "$HUDSON_URL" ] && [ -n "$WORKSPACE" ]; then
- echo "We appear to be running in a Hudson job."
- WORKING_DIR="$WORKSPACE"
- MAVEN_LOCAL_REPO_DIR="$HOME/.m2/hudson-release-$RELEASE_TYPE-repository"
- MAVEN_SETTINGS_FILE="$HOME/.m2/hudson-$JOB_NAME-settings.xml"
-elif [ -z "$WORKING_DIR" ]; then
- WORKING_DIR="$HOME/release/rhq"
-# MAVEN_LOCAL_REPO_DIR="$HOME/release/m2-repository"
- MAVEN_LOCAL_REPO_DIR="$HOME/.m2/repository"
- MAVEN_SETTINGS_FILE="$HOME/release/m2-settings.xml"
-fi
+ # Set the system character encoding to ISO-8859-1 to ensure i18log reads its
+ # messages and writes its resource bundle properties files in that encoding,
+ # since that is how the German and French I18NMessage annotation values are
+ # encoded and the encoding used by i18nlog to read in resource bundle
+ # property files.
+ LANG=en_US.iso8859
+ export LANG
+}
-PROJECT_GIT_URL="ssh://${GIT_USERNAME}@git.fedorahosted.org/git/rhq/rhq.git"
-
-MAVEN_ARGS="--settings $MAVEN_SETTINGS_FILE --batch-mode --errors
-Penterprise,dist,release"
-# TODO: We may eventually want to reenable tests for production releases.
-#if [ "$MODE" = "test" ]; then
-# MAVEN_ARGS="$MAVEN_ARGS -DskipTests=true"
-#fi
-MAVEN_ARGS="$MAVEN_ARGS -DskipTests=true"
-if [ "$RELEASE_TYPE" = "enterprise" ]; then
- MAVEN_ARGS="$MAVEN_ARGS -Dexclude-webdav "
- #MAVEN_ARGS="$MAVEN_ARGS -Dexclude-webdav -Djava5.home=$JAVA5_HOME/jre"
-fi
if [ -n "$RELEASE_DEBUG" ]; then
- MAVEN_ARGS="$MAVEN_ARGS --debug"
-fi
-if [ -n "$RELEASE_ADDITIONAL_MAVEN_ARGS" ]; then
- MAVEN_ARGS="$MAVEN_ARGS $RELEASE_ADDITIONAL_MAVEN_ARGS"
+ echo "Debug output is enabled."
+ set -x
fi
-# TODO: We may eventually want to reenable publishing of enterprise artifacts.
-#if [ "$MODE" = "production" ] && [ "$RELEASE_TYPE"
= "community" ]; then
-# MAVEN_RELEASE_PERFORM_GOAL="deploy"
-#else
- MAVEN_RELEASE_PERFORM_GOAL="install"
-#fi
+# TODO: Check that JDK version is < 1.7.
+validate_java_6
-TAG_VERSION=`echo $RELEASE_VERSION | sed 's/\./_/g'`
-RELEASE_TAG="${TAG_PREFIX}_${TAG_VERSION}"
+validate_java_5
+validate_maven
-# Set the system character encoding to ISO-8859-1 to ensure i18log reads its
-# messages and writes its resource bundle properties files in that encoding,
-# since that is how the German and French I18NMessage annotation values are
-# encoded and the encoding used by i18nlog to read in resource bundle
-# property files.
-LANG=en_US.iso8859
-export LANG
+validate_git
+set_variables
# Print out a summary of the environment.
echo "========================== Environment Variables
=============================="
commit 55411e1b5520b9f4e7ebab5e06e880f77e9c1b59
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Sep 28 11:08:38 2011 -0500
Take out the settings file from the actual release script. No reason to override
anything, the settings have should have been pre-configured to support a release.
diff --git a/release.sh b/release.sh
index 9ba123e..b64d762 100755
--- a/release.sh
+++ b/release.sh
@@ -1,9 +1,7 @@
#!/bin/sh
-
source `dirname $0`/rhq_bash.lib
-
# Functions
abort()
@@ -153,54 +151,6 @@ print_program_versions "${program_versions[@]}"
echo
"==============================================================================="
-
-# Create the Maven settings file.
-cat <<EOF >"${MAVEN_SETTINGS_FILE}"
-<settings>
- <localRepository>$MAVEN_LOCAL_REPO_DIR</localRepository>
-
- <profiles>
-
- <profile>
- <id>release</id>
- <properties>
-
<rhq.test.ds.server-name>hudson-qe.rhq.rdu.redhat.com</rhq.test.ds.server-name>
- <rhq.test.ds.port>5432</rhq.test.ds.port>
- <rhq.test.ds.db-name>rhq_release_tag</rhq.test.ds.db-name>
-
<rhq.test.ds.connection-url>jdbc:postgresql://hudson-qe.rhq.rdu.redhat.com:5432/rhq_release_tag</rhq.test.ds.connection-url>
- <rhq.test.ds.user-name>rhqadmin</rhq.test.ds.user-name>
- <rhq.test.ds.password>rhqadmin</rhq.test.ds.password>
- <rhq.test.ds.type-mapping>PostgreSQL</rhq.test.ds.type-mapping>
-
<rhq.test.ds.driver-class>org.postgresql.Driver</rhq.test.ds.driver-class>
-
<rhq.test.ds.xa-datasource-class>org.postgresql.xa.PGXADataSource</rhq.test.ds.xa-datasource-class>
-
<rhq.test.ds.hibernate-dialect>org.hibernate.dialect.PostgreSQLDialect</rhq.test.ds.hibernate-dialect>
- <!-- quartz properties -->
-
<rhq.test.quartz.driverDelegateClass>org.quartz.impl.jdbcjobstore.PostgreSQLDelegate</rhq.test.quartz.driverDelegateClass>
- <rhq.test.quartz.selectWithLockSQL>SELECT * FROM {0}LOCKS ROWLOCK WHERE
LOCK_NAME = ? FOR UPDATE</rhq.test.quartz.selectWithLockSQL>
-
<rhq.test.quartz.lockHandlerClass>org.quartz.impl.jdbcjobstore.StdRowLockSemaphore</rhq.test.quartz.lockHandlerClass>
-
- <DatabaseTest.nofail>true</DatabaseTest.nofail>
-
-
<rhq.testng.excludedGroups>agent-comm,comm-client,postgres-plugin,native-system</rhq.testng.excludedGroups>
-
- <gwt-plugin.extraJvmArgs>-Xms512M -Xmx1024M -XX:PermSize=256M
-XX:MaxPermSize=512M -Djava.io.tmpdir=gwt-tmp</gwt-plugin.extraJvmArgs>
- </properties>
- </profile>
-
- </profiles>
-
- <!-- This is used by the deploy plugin to publish release artifacts to the
jboss.org Nexus repo. -->
- <servers>
- <server>
- <id>jboss-releases-repository</id>
- <username>$JBOSS_ORG_USERNAME</username>
- <password>$JBOSS_ORG_PASSWORD</password>
- </server>
- </servers>
-
-</settings>
-EOF
-
# Clone and/or checkout the source from git.
if [ -d "$WORKING_DIR" ]; then