3
# get_file <base_url> <file> <dir>
4
# downlaods file from $base_url/$file into directory $dir
10
if [ ! -e $dir ]; then
13
if [ -e $dir/$file ]; then
16
pushd $dir > /dev/null
17
wget --no-check-certificate $base_url/$file
21
# setup_artifacts <tag> <suffix>
22
# downloads artifacts to build installer:
23
# 1. geoserver bin artifact
24
# 2. installer specific artifact specified by <suffix>
25
# files are unpacked into tmp directory
26
function setup_artifacts() {
30
local gs_artifact=geoserver-$tag-bin.zip
31
local installer_artifact=geoserver-$tag-$suf.zip
33
if [ -z $SKIP_DOWNLOAD ]; then
34
get_file $DIST_URL/$tag $gs_artifact files
35
get_file $DIST_URL/$tag $installer_artifact files
38
# unpack the artifacts
44
unzip -d tmp files/$installer_artifact
45
unzip -d tmp files/$gs_artifact
48
# upload_installer <tag> <file>
49
# uploads file <file> to distribution server under tag <tag>
50
function upload_installer() {
53
local ssh_opts="-i $DIST_PK -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
55
if [ -z $SKIP_UPLOAD ]; then
56
echo "uploading $file"
57
# add an extra / to beginning of file path to overcome issue with MinGW text substitution
58
# where the :/ remote path is converted to ;z: (and connection fails to resolve hostname)
59
# http://www.mingw.org/wiki/Posix_path_conversion
60
echo "scp $ssh_opts -P $DIST_PORT $file $DIST_USER@$DIST_HOST:/$DIST_PATH/$tag"
61
scp $ssh_opts -P $DIST_PORT $file $DIST_USER@$DIST_HOST:/$DIST_PATH/$tag
62
# set access permissions for www
63
echo "ssh $ssh_opts -p $DIST_PORT $DIST_USER@$DIST_HOST \"chmod 0644 '$DIST_PATH/$tag/$file'\""
64
ssh $ssh_opts -p $DIST_PORT $DIST_USER@$DIST_HOST "chmod 0644 '$DIST_PATH/$tag/$file'"
68
# start_installer_job <hudson_url> <user> <key> <tag>
69
# starts a hudson installer job
70
function start_installer_job() {
71
local job_url="$1/job/geoserver-installer/buildWithParameters?TAG=$4&token=buildme"
74
echo "executing installer job $job_url with credentials $creds"
75
curl -k --connect-timeout 10 --user $creds $job_url
78
function is_primary_branch_num() {
80
if [ "$( echo $str | egrep "[0-9]+\.x" )" == "$str" ] || [ "master" == "$str" ]; then
88
# is_version_nuym <str>
89
# tests a string to see if it is a x.y.z or x.y-z style version number
90
function is_version_num() {
92
if [ "$( echo $str | egrep "[0-9]+\.[0-9]+((\.|-).*)?" )" == "$str" ]; then
95
if [ "$( echo $str | egrep "[0-9]+-.*" )" == "$str" ]; then
103
# get_pom_version <pom>
104
# gets the version declared in a pom file
105
function get_pom_version() {
107
echo `grep "<version>" $pom | head -n 1 | sed 's/<.*>\(.*\)<\/.*>/\1/g' | sed 's/ //g'`
111
# gets the jira id for a version named <tag>
112
function get_jira_id() {
114
local jira_id=`curl -s -G $JIRA_REST/project/$JIRA_PROJ/versions | tr "{" "\n" | grep -F "\"$tag\"" | tr "," "\n" | grep "\"id\"" | sed 's/"id": *"\([0-9]\+\).*/\1/g'`
116
#sed 's/"id": *\([0-9]*\).*/\1/g'`
117
if [ ! -z $jira_id ]; then
122
# init_git <user> <emai>
123
# sets up git config for user/email
125
# setup the author, for some reason I can;t for the life of me get to this
126
# to work properly from a script using the --author option to git commit
127
git config user.name $1
128
git config user.email $2