In this post we will discuss abut most frequent issues faced in Jenkins build.
When you try to use docker image to run your jobs you may end up in creating some file which are created by root user ( from Docker image ). In this case from next build onwards we will see some issues to clean old workspace. Even if you try to use cleanUP workspace plugin you will end up with permission issues.
To avoid this issue please follow below steps
1) Install acl package based on your distribution.
apt-get install acl
apt-get install acl
apk add acl
pacman -S acl
apt-get install acl
yum install acl
dnf install acl
2) Follow below steps to clean workspace and apply acl on workspace folder. After this change you will see any file or folder which is created in workspace folder will have complete ownership of jenkins user.
$ rm -rf workspace # to avoid any inconsistencies in existing files
$ mkdir workspace
$ sudo setfacl -dm 'u:<your_jenkins_user_name>:rwx' workspace