Commit 2031626a authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

ci-base-image: entrypoint hackery to make sure PATH gets set

parent 1ff15b5a
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -27,6 +27,12 @@ RUN apt-get clean

RUN echo "runner ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/allow-runner-sudo
RUN echo 'APT::Get::Assume-Yes "1";' > /etc/apt/apt.conf.d/75assume-yes
RUN echo 'export PATH="$PATH:$HOME/.local/bin"' >> /home/runner/.bashrc

# We get run with bash --login. That reads .bash_profile, but not .bashrc.
RUN echo 'export PATH="$PATH:$HOME/.local/bin"' >> /home/runner/.bash_profile

USER runner

ADD entrypoint.sh /

ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]

docker/entrypoint.sh

0 → 100644
+15 −0
Original line number Diff line number Diff line
# According to
# https://docs.gitlab.com/runner/shells/#shell-profile-loading
# Gitlab runner's docker executor does not load shell startup files,
# because that's a great idea.
cmd=()
for i in "$@"; do
  cmd+=("$(echo "$i"| sed "/exec/s/bash/bash --login/g")")
done
echo "Using rewritten shell invocation received from executor."
echo "${cmd[@]}"
"${cmd[@]}"
retcode="$?"
echo "return code from command: $retcode"
exit "$retcode"