Skip to content

Commit

Permalink
move file operations in background
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinab25 authored Jun 30, 2021
1 parent cfd602d commit f5ea14a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docker-entrypoint-dind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ if [ -e /var/run/docker.sock ]; then
fi

#clean up workspace, delete files older than 1day
find /var/jenkins_home/worker/workspace -maxdepth 1 -type d -ctime +1 -exec rm -rf {} \;
find /var/jenkins_home/worker/workspace -maxdepth 1 -mindepth 1 -type d -mtime +1 -exec rm -rf {} \; &

if [ -n "$DOCKERHUB_USER" ] && [ -n "$DOCKERHUB_PASS" ]; then
SETTINGS_TPL='/tmp/settings.xml.j2'
SETTINGS_FILE=$HOME'/.m2/settings.xml'
chown -v jenkins:jenkins $HOME
find /var/jenkins_home/worker/workspace -maxdepth 1 -type d -mtime -1 -exec chown -v jenkins:jenkins {} \;
find /var/jenkins_home/worker/workspace -maxdepth 1 -mindepth 1 -type d -mtime -0.2 -exec chown -R jenkins:jenkins {} \; &
gosu jenkins mkdir $HOME/.m2
gosu jenkins j2 "$SETTINGS_TPL" > $SETTINGS_FILE
docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASS
Expand Down

0 comments on commit f5ea14a

Please sign in to comment.