BUILDER=""
OSRF=""
GIT="git"
+DETACH_NEEDED="YES"
# command line arguments
CLIENT_BUILD_ID=""
CLIENT_SERIES_ID=""
GIT_REMOTE="kcls"
-SKIP_DETACH=""
REATTACH=""
SKIP_APACHE=""
WEB_ONLY=""
REBUILD=""
BUILD_XUL=""
RESTART_ONLY=""
+STAFF_CLIENT_ONLY=""
# if the script exits early, SUCCESS will be left as 0,
# which is our sign to warn the user.
$0 -t kcls-2.4.001
Check out and update the git branch 'dev/berick/abc-123-foobar',
- then deploy with a staff client build ID of 'test-123'.
+ then deploy with a staff client build ID of 'rel_2_4_1'
- $0 -b dev/berick/abc-123-foobar -s test-123
+ $0 -b dev/berick/abc-123-foobar -s rel_2_4_1
- Pull changes to the currently checked out branch, avoid
- detaching the brick, then copy only the web files into place.
+ Pull changes to the currently checked out branch, then
+ copy only the web files into place.
- $0 -d -w -p
+ $0 -w -p
Options:
-r <git-remote>
Defaults to "kcls".
- -d
- Do NOT detach the server as one normally does for a brick.
- This is useful for development servers. The default is
- to always detach.
-
-a
Automatically reattach the brick after the update. This is
useful if there is no desire to manually test the brick
after the update. The default is to leave detached.
- This is ignored if -d is specified.
-n
Do not stop/start Apache. This is useful for non-brick
-x
Build a XUL client and place it in the published "builds"
- directory.
+ directory. This happens alongside a build/install/restart.
+ See -k for staff client building only.
+
+ -k Build a XUL client without performing any other installation
+ or restart actions. Flags -p, -t, -b are honored if
+ specified.
-f
Service startup sleep time in seconds. Defaults to
function inspect_params {
+ # no need to detach the brick when not restarting services
+ if [ -n "$STAFF_CLIENT_ONLY" -o -n "$WEB_ONLY" ]; then
+ DETACH_NEEDED=""
+ fi
+
+ if [ -n "$RESTART_ONLY" ]; then
+ # restart trumps all other variables.
+ # avoid warning about other variable issues
+ return
+ fi
+
if [ -z "$CLIENT_BUILD_ID" -a -n "$GIT_TAG" ]; then
# default to using the git tag if no client build ID is provided
CLIENT_BUILD_ID="$GIT_TAG";
}
function build_staff_client {
+ announce "Building staff client installer"
+
cd $XUL_DIR/builds/
if [ ! -r "xulrunner-$XULRUNNER_VERSION.en-US.win32.zip" ]; then
$OSRF wget "http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/$XULRUNNER_VERSION/runtimes/xulrunner-$XULRUNNER_VERSION.en-US.win32.zip"
set -e
}
-
-function deploy_code {
-
- announce "Building and installing Evergreen"
+function build_code {
+ announce "Building Evergreen"
# the separate incantations for $BUILDER / $OSRF are required
# becuase it's an error to preceded setting a variable with
make clean all > /dev/null
fi
fi
+}
+
+
+function deploy_code {
+ announce "Installing Evergreen"
# Put client server files under the build-id specific directory
# so we can track each build individually. A symlink from the
trap on_exit EXIT;
-while getopts "t:b:r:s:i:f:pdanwchxo" opt; do
+while getopts "t:b:r:s:i:f:panwchxok" opt; do
case $opt in
t) GIT_TAG="$OPTARG";;
b) GIT_BRANCH="$OPTARG";;
i) CLIENT_SERIES_ID="$OPTARG";;
f) START_SLEEP="$OPTARG";;
p) GIT_PULL="YES";;
- d) SKIP_DETACH="YES";;
a) REATTACH="YES";;
n) SKIP_APACHE="YES";;
w) WEB_ONLY="YES";;
c) REBUILD="YES";;
x) BUILD_XUL="YES";;
o) RESTART_ONLY="YES";;
+ k) STAFF_CLIENT_ONLY="YES";;
h|*) usage;
esac
done;
set_builder;
-if [ -z "$RESTART_ONLY" ]; then
- # restart trumps all other commands.
- inspect_params;
-fi
+inspect_params;
-if [ -z "$SKIP_DETACH" ]; then
+if [ -n "$DETACH_NEEDED" ]; then
if [ ! -f $PING_FILE ]; then
- announce "Detach requested, but no ping file exists at $PING_FILE"
- announce "Try -d to skip the brick detach step."
- exit;
- fi;
+ announce "No ping file found. Skipping detach."
- announce "Detaching brick and sleeping $DETACH_SLEEP seconds"
- $OSRF mv $PING_FILE $PING_FILE-
- sleep $DETACH_SLEEP
+ else
+ announce "Detaching brick and sleeping $DETACH_SLEEP seconds"
+ $OSRF mv $PING_FILE $PING_FILE-
+ sleep $DETACH_SLEEP
+ fi
fi;
cd $EVERGREEN_BASE;
if [ -n "$WEB_ONLY" ]; then
# web-only updates don't require restarts.
- fetch_code
+ fetch_code # no-op if no code options are specified
deploy_web
+
+elif [ -n "$STAFF_CLIENT_ONLY" ]; then
+ fetch_code # no-op if no code options are specified
+ build_code
+ build_staff_client
+
else
if [ -z "$SKIP_APACHE" ]; then
else
fetch_code;
+ build_code;
deploy_code;
start_services;
fi;
fi
-if [ -z "$SKIP_DETACH" ]; then
+if [ -f $PING_FILE- ]; then # we detached
if [ -n "$REATTACH" ]; then
announce "Reattaching brick after $START_SLEEP seconds"
sleep $START_SLEEP;