Hi,

I'm building artifacts in docker image and if I'm aborting a build, the 
deleteDir function fails to delete artifacts since
they were created with root user in docker and the function is called by 
jenkins user outside of docker. Is there any workaround?

pipeline {
    agent {label 'docker'}
    stages {
        stage('Build') {
            agent {
                docker {
                    image 'adoptopenjdk/openjdk8' args '-u root -v 
$HOME/.m2:/root/.m2' reuseNode true label 'docker'
                }
            }
            stages {
                stage ('Package') {
                        sh "./mvnw package"
                }
            }
    post {
always {deleteDir()}
    } 
        }
    }
    post {
        always {deleteDir()}
    }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/a189d9e3-5f00-4144-a561-f720f797f9b8%40googlegroups.com.

Reply via email to