diff --git a/ci/entrypoint.sh b/ci/entrypoint.sh index c3d8e56..b160eb2 100644 --- a/ci/entrypoint.sh +++ b/ci/entrypoint.sh @@ -1,145 +1,113 @@ #!/bin/bash if [ ! -d "/srv/stick.git" ]; then git clone https://git.kolab.org/diffusion/QA/stick.git /srv/stick.git else pushd /srv/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 -# Create 3 as an alias for 1, so the _shell function -# can output data without the caller getting the input. -exec 3>&1 +source /functions.sh # If PS1 is set, we're interactive if [ ! -z "${PS1}" ]; then # Set a sensible prompt PS1='[\u@${IMAGE} \W]\$ ' export GIT_PS1_SHOWDIRTYSTATE=1 export GIT_PS1_SHOWUNTRACKEDFILES=1 export GIT_PS1_SHOWUPSTREAM="auto verbose" if [ ! -f "/etc/bash_completion" ]; then if [ -f "/etc/bash_completion.d/git" ]; then . /etc/bash_completion.d/git PS1='[\u@${IMAGE} \W$(__git_ps1 " (%s)")]\$ ' fi else PS1='[\u@${IMAGE} \W$(__git_ps1 " (%s)")]\$ ' fi export PS1 PROMPT_COMMAND="echo -ne '\033]0;${IMAGE} (in ${HOSTNAME})\007'" if [ -f "/usr/share/git-core/contrib/completion/git-prompt.sh" ]; then source /usr/share/git-core/contrib/completion/git-prompt.sh fi fi -function _report { - echo $(printf '%0.1s' "="{1..72}) - cat ${TMPDIR:-/tmp}/report.log - rm -rf ${TMPDIR:-/tmp}/report.log - echo $(printf '%0.1s' "="{1..72}) -} - -function _report_msg { - printf "%*s" $(( ( ${BASH_SUBSHELL} - 1 ) * 4 )) " " >> ${TMPDIR:-/tmp}/report.log - echo "$@" >> ${TMPDIR:-/tmp}/report.log -} - -export -f _report_msg - -function _shell { - echo "Running $@ ..." >&3 - $@ >&3 2>&3 ; retval=$? - if [ ${retval} -eq 0 ]; then - _report_msg "Running '$@' OK (at $(git rev-parse HEAD))" - echo "Running $@ OK (at $(git rev-parse HEAD))" >&3 - else - _report_msg "Running '$@' FAILED (at $(git rev-parse HEAD))" - echo "Running $@ FAILED (at $(git rev-parse HEAD))" >&3 - fi - - echo ${retval} -} - -export -f _shell - if [ ! -d "/srv/${PACKAGE}.git" ]; then git clone ${RO_URI} /srv/${PACKAGE}.git pushd /srv/${PACKAGE}.git for branch in $(git branch -la | sed -e 's/^* //g' -e 's/ //g' -e '/remotes\/origin\/HEAD/d' -e 's|remotes/origin/||g'); do git checkout $branch done popd else pushd /srv/${PACKAGE}.git git remote set-url origin ${RO_URI} git fetch origin git reset --hard origin/master git clean -d -f -x for branch in $(git branch -la | sed -e 's/^* //g' -e 's/ //g' -e '/remotes\/origin\/HEAD/d' -e 's|remotes/origin/||g'); do git checkout $branch done popd fi yum clean metadata yum -y update rpmdev-setuptree pushd /srv/${PACKAGE}.git if [ ! -z "${COMMIT}" ]; then git checkout ${COMMIT} fi # TODO: A differential has a base commit. retval=$(_shell yum-builddep -y --disablerepo=openSUSE_Tools ${PACKAGE}) if [ ${retval} -ne 0 ]; then _report exit 1 fi if [ -x "../stick.git/drydocker/${PACKAGE}/test_build.sh" ]; then retval=$(_shell ../stick.git/drydocker/${PACKAGE}/test_build.sh) if [ ${retval} -ne 0 ]; then _report exit 1 fi fi if [ -x "../stick.git/drydocker/${PACKAGE}/test_unit.sh" ]; then retval=$(_shell ../stick.git/drydocker/${PACKAGE}/test_unit.sh) if [ ${retval} -ne 0 ]; then _report exit 1 fi fi if [ -x "../stick.git/drydocker/${PACKAGE}/test_obs.sh" ]; then retval=$(_shell ../stick.git/drydocker/${PACKAGE}/test_obs.sh) if [ ${retval} -ne 0 ]; then _report exit 1 fi fi popd _report diff --git a/ci/functions.sh b/ci/functions.sh new file mode 100644 index 0000000..9b4edbc --- /dev/null +++ b/ci/functions.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Create 3 as an alias for 1, so the _shell function +# can output data without the caller getting the input. +exec 3>&1 + +function _report { + echo $(printf '%0.1s' "="{1..72}) + cat ${TMPDIR:-/tmp}/report.log + rm -rf ${TMPDIR:-/tmp}/report.log + echo $(printf '%0.1s' "="{1..72}) +} + +export -f _report + +function _report_msg { + printf "%*s" $(( ( ${BASH_SUBSHELL} - 1 ) * 4 )) " " >> ${TMPDIR:-/tmp}/report.log + echo "$@" >> ${TMPDIR:-/tmp}/report.log +} + +export -f _report_msg + +function _shell { + echo "Running $@ ..." >&3 + $@ >&3 2>&3 ; retval=$? + if [ ${retval} -eq 0 ]; then + _report_msg "Running '$@' OK (at $(git rev-parse HEAD))" + echo "Running $@ OK (at $(git rev-parse HEAD))" >&3 + else + _report_msg "Running '$@' FAILED (at $(git rev-parse HEAD))" + echo "Running $@ FAILED (at $(git rev-parse HEAD))" >&3 + fi + + echo ${retval} +} + +export -f _shell + diff --git a/ci/maipo b/ci/maipo index b9df11e..ed69045 100644 --- a/ci/maipo +++ b/ci/maipo @@ -1,91 +1,101 @@ -FROM centos:centos7 +FROM docker.io/centos:centos7 MAINTAINER Kolab Systems ADD http://obs.kolabsys.com/repositories/Kolab:/Development/CentOS_7/Kolab:Development.repo \ /etc/yum.repos.d/Kolab:Development.repo RUN rpm --import https://ssl.kolabsys.com/community.asc ADD http://download.opensuse.org/repositories/openSUSE:Tools/CentOS_7/openSUSE:Tools.repo \ /etc/yum.repos.d/openSUSE:Tools.repo RUN rpm --import http://download.opensuse.org/repositories/openSUSE:/Tools/CentOS_7/repodata/repomd.xml.key RUN sed -i -e '/tsflags=nodocs/d' /etc/yum.conf && \ sed -r -i -e 's/enabled\s*=\s*1/enabled=0/g' /etc/yum/pluginconf.d/fastestmirror.conf RUN yum -y reinstall \* ENV IMAGE maipo -ADD https://raw.githubusercontent.com/adelton/docker-freeipa/master/dbus.service /etc/systemd/system/dbus.service +ADD http://cgit.kolab.org/docker/plain/ci/files.d/dbus.service /etc/systemd/system/dbus.service RUN ln -sf dbus.service /etc/systemd/system/messagebus.service -ADD https://raw.githubusercontent.com/adelton/docker-freeipa/master/httpd.service /etc/systemd/system/httpd.service +ADD http://cgit.kolab.org/docker/plain/ci/files.d/httpd.service /etc/systemd/system/httpd.service -ADD https://raw.githubusercontent.com/adelton/docker-freeipa/master/systemctl /usr/bin/systemctl -ADD https://raw.githubusercontent.com/adelton/docker-freeipa/master/systemctl-socket-daemon /usr/bin/systemctl-socket-daemon +ADD http://cgit.kolab.org/docker/plain/ci/files.d/systemctl /usr/bin/systemctl +ADD http://cgit.kolab.org/docker/plain/ci/files.d/systemctl-socket-daemon /usr/bin/systemctl-socket-daemon RUN chmod -v a+rx \ /usr/bin/systemctl \ /usr/bin/systemctl-socket-daemon ADD https://cgit.cyrus.foundation/docker/plain/.vimrc /root/.vimrc RUN yum clean all && \ yum -y install epel-release && \ yum -y install --skip-broken \ ant \ atk-devel.i686 \ build \ cairo-devel.i686 \ fontconfig-devel.i686 \ + freetype-devel \ freetype-devel.i686 \ gcc.i686 \ gcc-c++.i686 \ gdk-pixbuf-devel.i686 \ git \ glibc-devel \ glibc-devel.i686 \ glib2-devel.i686 \ + gperf \ gtk2-devel \ gtk2-devel.i686 \ ibus-devel \ java-devel \ osc \ pango-devel.i686 \ passwd \ perl-Digest-MD5 \ perl-TimeDate \ python-selenium \ rpmdevtools \ + ruby \ sudo \ vim-enhanced \ yum-utils \ @development \ @fedora-packager && \ yum-builddep -y --skip-broken \ $(yum -d 0 -e 0 \ --disablerepo=\* \ --enablerepo=Kolab_Development \ list available 2>&1 | \ grep -vE "^(Available Packages|\s+)" | \ awk '{print $1}' \ - ) + ) qt5-qtbase WORKDIR /srv RUN git clone https://github.com/google/closure-compiler.git closure-compiler.git WORKDIR /srv/closure-compiler.git RUN ant jar WORKDIR /srv RUN git clone https://github.com/SeleniumHQ/selenium.git selenium.git WORKDIR /srv/selenium.git RUN ./go --trace --verbose build +WORKDIR /srv/ +RUN git clone https://github.com/ariya/phantomjs.git phantomjs.git +WORKDIR /srv/phantomjs.git +RUN ./build.sh --confirm + WORKDIR /srv ADD https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2 /srv/phantomjs-1.9.7-linux-x86_64.tar.bz2 RUN tar jxvf phantomjs-1.9.7-linux-x86_64.tar.bz2 RUN cp phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin +ADD https://cgit.kolab.org/docker/plain/ci/functions.sh / + ADD https://cgit.kolab.org/docker/plain/ci/entrypoint.sh / RUN chmod 755 /entrypoint.sh ENTRYPOINT [ "/entrypoint.sh" ]