This is an automated email from the ASF dual-hosted git repository. vatamane pushed a commit to branch improve-jenkins-workspace-cleanup in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 678264cc6a2565f2c736a1ef46b6c71b38595925 Author: Nick Vatamaniuc <[email protected]> AuthorDate: Sat Mar 21 22:54:28 2026 -0400 Improve/fix jenkins workspace cleanup Previously `${WORKSPACE}/.[a-zA-Z]` would only delete files names like `.a`, `.b`, `.A`. To avoid repeating the command, including the "UGH" comment, make a function for it and explain what the deal there. It turns out both issues (the original Jira one and the GH one) are now stale and closed. --- build-aux/Jenkinsfile | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/build-aux/Jenkinsfile b/build-aux/Jenkinsfile index decda5153..735654067 100644 --- a/build-aux/Jenkinsfile +++ b/build-aux/Jenkinsfile @@ -282,6 +282,14 @@ def String configure(config) { return result } +// Use this to delete all the files inside the workspace dir without +// deleting the directory itself. There is an issue withing docker containers +// related to that https://issues.jenkins-ci.org/browse/JENKINS-41894 +// +def String wscleanup() { + return 'rm -rf ${WORKSPACE}/* ${WORKSPACE}/.[a-zA-Z0-9]*' +} + // Credit to https://stackoverflow.com/a/69222555 for this technique. // We can use the scripted pipeline syntax to dynamically generate stages, // and inject them into a map that we pass to the `parallel` step in a script. @@ -346,7 +354,7 @@ def generateNativeStage(platform) { finally { junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml' sh 'killall -9 beam.smp || true' - sh 'rm -rf ${WORKSPACE}/* ${WORKSPACE}/.[a-zA-Z]' + sh "${wscleanup()}" } } else { //steps to configure and build CouchDB on Windows platforms @@ -505,7 +513,7 @@ def generateContainerStage(platform) { } finally { junit '**/.eunit/*.xml, **/_build/*/lib/couchdbtest/*.xml, **/src/mango/nosetests.xml, **/test/javascript/junit.xml' - sh 'rm -rf ${WORKSPACE}/* ${WORKSPACE}/.[a-zA-Z]' + sh "${wscleanup()}" } } @@ -531,7 +539,7 @@ def generateContainerStage(platform) { error("Build step failed with error: ${err.getMessage()}") } finally { - sh 'rm -rf ${WORKSPACE}/* ${WORKSPACE}/.[a-zA-Z]' + sh "${wscleanup()}" } } } @@ -603,8 +611,7 @@ pipeline { } post { cleanup { - // UGH see https://issues.jenkins-ci.org/browse/JENKINS-41894 - sh 'rm -rf ${WORKSPACE}/* ${WORKSPACE}/.[a-zA-Z]' + sh "${wscleanup()}" } } } // stage 'Setup Environment' @@ -632,8 +639,7 @@ pipeline { } post { cleanup { - // UGH see https://issues.jenkins-ci.org/browse/JENKINS-41894 - sh 'rm -rf ${WORKSPACE}/* ${WORKSPACE}/.[a-zA-Z]' + sh "${wscleanup()}" } } } // stage Build Docs @@ -669,8 +675,7 @@ pipeline { sh 'ls -l ${WORKSPACE}' } cleanup { - // UGH see https://issues.jenkins-ci.org/browse/JENKINS-41894 - sh 'rm -rf ${WORKSPACE}/* ${WORKSPACE}/.[a-zA-Z]' + sh "${wscleanup()}" } } } // stage Build Release Tarball
