diff --git a/drydocker.sh b/drydocker.sh index 1f1997c..191afb3 100755 --- a/drydocker.sh +++ b/drydocker.sh @@ -1,285 +1,286 @@ #!/bin/bash function usage { set - -x echo "Usage: $0 [options]" echo "" echo "Options:" echo "" echo "--id " echo "" echo " The ID of the buildable." echo "" echo "--commit " echo "" echo " The commit ID to build and test." echo "" echo "--differential " echo "" echo " The differential ID to build and test." echo "" echo "--phid " echo "" echo " The Phabricator internal ID of the buildable." echo "" echo "--platforms " echo "" echo " The platforms to run tests on." echo "" echo "--uri " echo "" echo " The URI to the source code management repository," echo " also used to determine response credentials and" echo " feedback locations." echo "" echo " If not specified, assumes git.kolab.org is the" echo " appropriate Phabricator instance." echo "" echo "--vcs " echo "" echo " Version control system, defaults to 'git'" echo "" echo "Limiting tests run -- if neither is specified, all tests are" echo "run:" echo "" echo " --test-build" echo "" echo " Limit the tests run to just build tests." echo "" echo " --test-functional" echo "" echo " Limit the tests run to just functional tests." echo "" echo " --test-integration" echo "" echo " Limit the tests run to just integration tests." echo "" echo " --test-performance" echo "" echo " Limit the tests run to just performance tests." echo "" echo " --test-unit" echo "" echo " Limit the tests run to just unit tests." echo "" echo " --test-obs" echo "" echo " Check-in to OBS after all tests complete." exit 1 } test_build=0 test_functional=0 test_integration=0 test_performance=0 test_unit=0 test_obs=0 vcs="git" while [ $# -gt 0 ]; do case $1 in --id) id=$(eval echo $2) shift; shift ;; # buildable.commit --commit) commit=$(eval echo $2) shift; shift ;; # buildable.revision --differential) differential=$(eval echo $2) shift; shift ;; # target.phid --phid) phid=$(eval echo $2) shift; shift ;; --platforms) platforms=$(eval echo $2) shift; shift ;; --test-build) test_build=1 shift ;; --test-functional) test_functional=1 shift ;; --test-integration) test_integration=1 shift ;; --test-performance) test_performance=1 shift ;; --test-unit) test_unit=1 shift ;; --test-obs) test_obs=1 shift ;; --uri) uri=$(eval echo $2) shift; shift ;; --vcs) vcs=$(eval echo $2) shift; shift ;; *) usage ;; esac done set -x if [ -z "${commit}" -a -z "${differential}" ]; then echo "At least one of commit or differential is required." exit 1 fi if [ -z "${uri}" ]; then echo "No version control system URI specified." exit 1 fi if [ \ ${test_build} -eq 0 -a \ ${test_functional} -eq 0 -a \ ${test_integration} -eq 0 -a \ ${test_performance} -eq 0 -a \ ${test_unit} -eq 0 -a \ ${test_obs} -eq 0 ]; then test_build=1 test_functional=1 test_integration=1 test_performance=1 test_unit=1 test_obs=1 fi if [ -z "${vcs}" ]; then echo "No version control system specified." exit 1 fi case ${vcs} in git) package=$(basename ${uri} .git) ro_uri=$(echo ${uri} | sed -e 's|ssh://git@|https://|g') ;; *) echo "Unsupported version control system: ${vcs}" exit 1 ;; esac # Translate the package from git repo name to # an actual package name. case ${package} in freebusy) package="kolab-freebusy" ;; hkccp) package="kolab-hkccp" uri="ssh://git@git.kolab.org/diffusion/H/hkccp.git" ro_uri="ssh://git@git.kolab.org/diffusion/H/hkccp.git" ;; roundcubemail) uri="https://git.kolab.org/diffusion/R/roundcubemail" ro_uri="https://git.kolab.org/diffusion/R/roundcubemail" ;; syncroton) package="kolab-syncroton" ;; webadmin) package="kolab-webadmin" ;; esac export TMPDIR="$(pwd)" if [ ! -d "${package}.git" ]; then git clone ${ro_uri} ${package}.git pushd ${package}.git git checkout ${commit} popd else pushd ${package}.git git remote set-url origin ${ro_uri} git fetch origin git reset --hard origin/master git clean -d -f -x git checkout ${commit} popd fi if [ "${package}" != "stick" ]; then if [ ! -d "stick.git" ]; then git clone https://git.kolab.org/diffusion/QA/stick.git stick.git else pushd stick.git git remote set-url origin https://git.kolab.org/diffusion/QA/stick.git git fetch origin git reset --hard origin/master git clean -d -f -x popd fi fi export commit export differential export id export package export phid export ro_uri export uri export vcs export test_build export test_functional export test_integration export test_performance export test_unit +export test_obs if [ -x "stick.git/drydocker/${package}/build.sh" ]; then pushd ${package}.git ../stick.git/drydocker/${package}/build.sh; retval=$? popd else echo "I have no build script for package '${package}'" fi cd /var/tmp rm -rf ${TMPDIR} exit ${retval}