Search code examples
jenkinsjenkins-pipelinejenkins-declarative-pipeline

Jenkins declarative pipeline @tmp folders


I'd try to understand the root cause of reason why Jenkins creates such directories as below.. When I try to find coverage report, I realise that it is located in my-application-ms@2 rather than my-application-ms. Meanwhile I checked rest of directories abd there is only SecretFiles which is empty.

So what is the best way to delete rest of directories which current directory should be always my-application-ms .. Should I specify the each dir in post section ?Is there any doubt to delete rest of directories?

  • my-application-ms
  • my-application-ms@2
  • my-application-ms@2@tmp
  • my-application-ms@tmp

 post{
    failure{
        notifyBuild('FAILED')
    }
    success{
        notifyBuild('SUCCESSFUL')
    }
    aborted{
        notifyBuild('FAILED')
    }
    always {
        deleteDir() /* clean up our workspace */
    }
}

Solution

  • I think you should rather use special step type for workspace clean up. cleanWs should do the job for you.