diff --git a/ci/entrypoint.sh b/ci/entrypoint.sh index d3abd7e..af48b69 100644 --- a/ci/entrypoint.sh +++ b/ci/entrypoint.sh @@ -1,126 +1,128 @@ #!/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 # 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 cat > /root/.oscrc << EOF [general] apiurl = https://obs.kolabsys.com +user = docker +password = QfF1FqSk4y3MHIK EOF 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} * 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 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 popd fi yum clean metadata yum -y update rpmdev-setuptree pushd /srv/${PACKAGE}.git if [ ! -z "${COMMIT}" ]; then git checkout ${COMMIT} fi retval=$(_shell yum-builddep -y ${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 popd _report