I have an RHEL 7 Jenkins agent. On this agent, I have configured a pipeline to simply pull some code and do a
sh 'docker-compose up'
with the following compose file.
version: '3'
services:
pythontest:
image: python:3.6
volumes:
- ./logs:/usr/local/logs
The issue comes in the post step, where I want to do a cleanup and delete all the folders and files in the workspace. It seems that the files that were created by the volume are owned by root and only root and write to them. So Jenkins can't delete them. The post step is a simple call to cleanWS
cleanWs deleteDirs: true
How can I let the Jenkins user be the owner of the files so they can be cleaned up?