123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- function get_file() {
- local base_url=$1
- local file=$2
- local dir=$3
- if [ ! -e $dir ]; then
- mkdir $dir
- fi
- if [ -e $dir/$file ]; then
- rm $dir/$file
- fi
- pushd $dir > /dev/null
- wget --no-check-certificate $base_url/$file
- popd > /dev/null
- }
- function setup_artifacts() {
- local tag=$1
- local suf=$2
- local gs_artifact=geoserver-$tag-bin.zip
- local installer_artifact=geoserver-$tag-$suf.zip
- if [ -z $SKIP_DOWNLOAD ]; then
- get_file $DIST_URL/$tag $gs_artifact files
- get_file $DIST_URL/$tag $installer_artifact files
- fi
-
- if [ -e tmp ]; then
- rm -rf tmp
- fi
- mkdir -p tmp
- unzip -d tmp files/$installer_artifact
- unzip -d tmp files/$gs_artifact
- }
- function upload_installer() {
- local tag=$1
- local file=$2
- local ssh_opts="-i $DIST_PK -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
- if [ -z $SKIP_UPLOAD ]; then
- echo "uploading $file"
-
-
-
- echo "scp $ssh_opts -P $DIST_PORT $file $DIST_USER@$DIST_HOST:/$DIST_PATH/$tag"
- scp $ssh_opts -P $DIST_PORT $file $DIST_USER@$DIST_HOST:/$DIST_PATH/$tag
-
- echo "ssh $ssh_opts -p $DIST_PORT $DIST_USER@$DIST_HOST \"chmod 0644 '$DIST_PATH/$tag/$file'\""
- ssh $ssh_opts -p $DIST_PORT $DIST_USER@$DIST_HOST "chmod 0644 '$DIST_PATH/$tag/$file'"
- fi
- }
- function start_installer_job() {
- local job_url="$1/job/geoserver-installer/buildWithParameters?TAG=$4&token=buildme"
- local creds=$2:$3
- echo "executing installer job $job_url with credentials $creds"
- curl -k --connect-timeout 10 --user $creds $job_url
- }
- function is_primary_branch_num() {
- local str=$1
- if [ "$( echo $str | egrep "[0-9]+\.x" )" == "$str" ] || [ "master" == "$str" ]; then
- echo "1"
- else
- echo "0"
- fi
- }
- function is_version_num() {
- local str=$1
- if [ "$( echo $str | egrep "[0-9]+\.[0-9]+((\.|-).*)?" )" == "$str" ]; then
- echo "1"
- else
- if [ "$( echo $str | egrep "[0-9]+-.*" )" == "$str" ]; then
- echo "1"
- else
- echo "0"
- fi
- fi
- }
- function get_pom_version() {
- local pom=$1
- echo `grep "<version>" $pom | head -n 1 | sed 's/<.*>\(.*\)<\/.*>/\1/g' | sed 's/ //g'`
- }
- function get_jira_id() {
- local tag=$1
- 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'`
-
- if [ ! -z $jira_id ]; then
- echo $jira_id
- fi
- }
- function init_git() {
-
-
- git config user.name $1
- git config user.email $2
- }
|