Skip to content

Commit

Permalink
rm workspace if cleanWs() fails (#4344)
Browse files Browse the repository at this point in the history
fix: #4328

Signed-off-by: Lan Xia <[email protected]>
  • Loading branch information
llxia authored Feb 15, 2023
1 parent 9e1e799 commit 083ff30
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,18 @@ def testBuild() {
terminateTestProcesses()

if (!params.KEEP_WORKSPACE) {
// cleanWs() does not work in some cases, so set opts below
cleanWs disableDeferredWipeout: true, deleteDirs: true
try {
// cleanWs() does not work in some cases, so set opts below
cleanWs disableDeferredWipeout: true, deleteDirs: true
} catch (Exception e) {
echo 'Exception: ' + e.toString()
//cleanWs has issue to delete workspace that contains non-ASCII filename in TKG output https://issues.jenkins.io/browse/JENKINS-33478
//cannot delete workspace directly. Otherwise, Jenkins job will abort due to missing workspace
sh "rm -rf ${env.WORKSPACE}/aqa-tests/TKG"
// call cleanWs() again
cleanWs disableDeferredWipeout: true, deleteDirs: true
}

// clean up remaining core files
if (PLATFORM.contains("mac")) {
sh "find /cores -name '*core*' -print 2>/dev/null -exec rm -f {} \\; || true"
Expand Down

0 comments on commit 083ff30

Please sign in to comment.