fix: create XDG_RUNTIME if workspace is mounted
ZeroDownTime/jenkins-podman/pipeline/head There was a failure building this commit Details

This commit is contained in:
Stefan Reimer 2022-07-11 12:56:04 +00:00
parent 664f10daf2
commit f93b715dde
2 changed files with 7 additions and 2 deletions

View File

@ -26,6 +26,7 @@ ADD --chown=$USER:$USER html.tpl /home/$USER
# Rootless podman
RUN mkdir -p /home/$USER/.config/containers
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
ADD --chown=$USER:$USER conf/containers.conf conf/registries.conf conf/storage.conf /home/$USER/.config/containers
RUN echo -e "$USER:1:999\n$USER:1001:64535" > /etc/subuid && \
@ -36,10 +37,10 @@ RUN echo -e "$USER:1:999\n$USER:1001:64535" > /etc/subuid && \
# Patch jenkins-agent to launch podman service
RUN sed -i -e 's/exec \$JAVA_BIN/podman system service -t0\&\n exec \$JAVA_BIN/' /usr/local/bin/jenkins-agent
ENV XDG_RUNTIME_DIR=/home/$USER/agent
ENV XDG_RUNTIME_DIR=/home/$USER/agent/xdg-run
ENV _CONTAINERS_USERNS_CONFIGURED=""
ENV TRIVY_TEMPLATE="@/home/jenkins/html.tpl"
USER $USER
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/jenkins-agent"]
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"]

4
entrypoint.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
mkdir -p $HOME/agent/xdg-run
/usr/local/bin/jenkins-agent