diff --git a/t/Dockerfile b/t/Dockerfile index 7b6b16c..0295673 100644 --- a/t/Dockerfile +++ b/t/Dockerfile @@ -5,7 +5,7 @@ FROM docker.mgm.sipwise.com/sipwise-bullseye:latest # is updated with the current date. It will force refresh of all # of the base images and things like `apt-get update` won't be using # old cached versions when the Dockerfile is built. -ENV REFRESHED_AT 2021-05-03 +ENV REFRESHED_AT 2023-03-24 RUN apt-get update && \ apt-get install --assume-yes \ @@ -17,6 +17,8 @@ RUN apt-get update && \ RUN echo './t/testrunner' >>/root/.bash_history +RUN git config --global --add safe.directory /code + WORKDIR /code/ ################################################################################ diff --git a/t/testrunner b/t/testrunner index b39367a..40a93ab 100755 --- a/t/testrunner +++ b/t/testrunner @@ -36,6 +36,16 @@ if [ -z "${branch:-}" ] ; then branch="none" fi +# only run inside docker environments as root user +if [ -f /.dockerenv ] && [[ "$(id -u)" == "0" ]] ; then + # the environment passed to docker might claim to have + # /var/lib/jenkins for $HOME, but we might be running + # under user root, so ensure the ~/.gitconfig can be found + # at the appropriate place + echo "Fixing HOME for user root (changing from '${HOME}' to '/root')" + export HOME=/root/ +fi + if [[ "${release}" =~ ^release-mr ]] ; then echo "release detected" short_release=${release%%-update}