diff --git a/drydocker.sh b/drydocker.sh index a43313e..488174d 100644 --- a/drydocker.sh +++ b/drydocker.sh @@ -1,204 +1,204 @@ #!/bin/bash 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=$2 + id=$(eval echo $2) shift; shift ;; # buildable.commit --commit) - commit=$2 + commit=$(eval echo $2) shift; shift ;; # buildable.revision --differential) - differential=$2 + differential=$(eval echo $2) shift; shift ;; # target.phid --phid) - phid=$2 + phid=$(eval echo $2) shift; shift ;; --platforms) - platforms=$2 + 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=$2 + uri=$(eval echo $2) shift; shift ;; --vcs) - vcs=$2 + 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 [ \ ${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 pushd /var/tmp/${id} git clone ${ro_uri} ${package}.git pushd ${package}.git git checkout ${commit} popd if [ "${package}" == "stick" ]; then md51=$(md5sum ${package}.git/drydocker.sh | awk '{print $1}') md52=$(md5sum /usr/local/bin/drydocker | awk '{print $1}') if [ "${md51}" != "${md52}" ]; then cp -f ${package}.git/drydocker.sh /usr/local/bin/drydocker chmod 755 /usr/local/bin/drydocker echo "Refreshed /usr/local/bin/drydocker" fi fi popd echo "At this stage, we're just going to be successful." exit 0