diff --git a/drydocker.sh b/drydocker.sh index b506151..04ac32c 100755 --- a/drydocker.sh +++ b/drydocker.sh @@ -1,244 +1,244 @@ #!/bin/bash set -x -exec 2>&1 - function usage { 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." exit 1 } test_build=0 test_functional=0 test_integration=0 test_performance=0 test_unit=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 ;; --uri) uri=$(eval echo $2) shift; shift ;; --vcs) vcs=$(eval echo $2) shift; shift ;; *) usage ;; esac done 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 \ ]; then test_build=1 test_functional=1 test_integration=1 test_performance=1 test_unit=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 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 if [ -x "stick.git/drydocker/${package}/build.sh" ]; then pushd ${package}.git ../stick.git/drydocker/${package}/build.sh popd +else + echo "I have no build script for package '${package}'" fi echo "At this stage, we're just going to be successful." rm -rf ${TMPDIR} exit 0