diff --git a/drydocker.sh b/drydocker.sh index c17dbfe..1967150 100755 --- a/drydocker.sh +++ b/drydocker.sh @@ -1,245 +1,245 @@ #!/bin/bash set -x 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 + ../stick.git/drydocker/${package}/build.sh; retval=$? popd else echo "I have no build script for package '${package}'" fi -echo "At this stage, we're just going to be successful." cd /var/tmp rm -rf ${TMPDIR} -exit 0 + +exit ${retval} diff --git a/drydocker/docker/build.sh b/drydocker/docker/build.sh index dd26925..d9dc9fc 100755 --- a/drydocker/docker/build.sh +++ b/drydocker/docker/build.sh @@ -1,22 +1,22 @@ #!/bin/bash pushd ci # Require free disk space (>= 30%) df=$(df /var/lib/docker/devicemapper 2>/dev/null | tail -n 1 | awk '{print $4/$2}') if [ -z "${df}" ]; then echo "Undetermined amount of free space, cleaning up in any case." make clean elif [ $( bc <<< "${df} <= 0.30" ) == 1 ]; then make clean df=$(df /var/lib/docker/devicemapper 2>/dev/null | tail -n 1 | awk '{print $4/$2}') if [ $( bc <<< "$df <= 0.30" ) == 1 ]; then echo "Cannot get disk space consumption to under 70%" exit 1 fi fi -make -B all +make -B all || exit $? popd diff --git a/drydocker/pykolab/build.sh b/drydocker/pykolab/build.sh index 5e31c10..518617f 100755 --- a/drydocker/pykolab/build.sh +++ b/drydocker/pykolab/build.sh @@ -1,24 +1,26 @@ #!/bin/bash set -x docker run -it \ --attach=stdout \ --attach=stderr \ --detach=false \ -e "ID=${id}" \ -e "COMMIT=${commit}" \ -e "DIFFERENTIAL=${differential}" \ -e "PACKAGE=${package}" \ -e "PHAB_CERT=${PHAB_CERT}" \ -e "PHAB_USER=${PHAB_USER}" \ -e "PHID=${phid}" \ -e "URI=${uri}" \ -e "RO_URI=${ro_uri}" \ -e "VCS=${vcs}" \ -e "TEST_BUILD=${test_build}" \ -e "TEST_FUNCTIONAL=${test_functional}" \ -e "TEST_INTEGRATION=${test_integration}" \ -e "TEST_PERFORMANCE=${test_performance}" \ -e "TEST_UNIT=${test_unit}" \ kolab/ci-maipo + +exit $? diff --git a/drydocker/stick/build.sh b/drydocker/stick/build.sh index 5b0838b..a8bab67 100755 --- a/drydocker/stick/build.sh +++ b/drydocker/stick/build.sh @@ -1,15 +1,15 @@ #!/bin/bash md51=$(md5sum ${TMPDIR}/stick.git/drydocker.sh | awk '{print $1}') md52=$(md5sum /usr/local/bin/drydocker | awk '{print $1}') if [ "${md51}" != "${md52}" ]; then cp -f ${TMPDIR}/stick.git/drydocker.sh /usr/local/bin/drydocker chmod 755 /usr/local/bin/drydocker echo "Refreshed /usr/local/bin/drydocker" fi git clone https://git.kolab.org/diffusion/DO/docker.git ${TMPDIR}/docker.git pushd ${TMPDIR}/docker.git/ci -make all +make all ; exit $? popd