Skip to content

Commit

Permalink
rm workspace/aqa-tests/TKG if cleanWs() fails
Browse files Browse the repository at this point in the history
Signed-off-by: Sophia Guo <[email protected]>
  • Loading branch information
sophia-guo committed Mar 21, 2023
1 parent d405343 commit 8b4bdce
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
32 changes: 16 additions & 16 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -871,18 +871,7 @@ def testBuild() {
terminateTestProcesses()

if (!params.KEEP_WORKSPACE) {
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
}

forceCleanWS()
// clean up remaining core files
if (PLATFORM.contains("mac")) {
sh "find /cores -name '*core*' -print 2>/dev/null -exec rm -f {} \\; || true"
Expand Down Expand Up @@ -1245,8 +1234,7 @@ def run_parallel_tests() {
stage ("Parallel Tests") {
def childJobs = parallel parallel_tests
node {
// cleanWs() does not work in some cases, so set opts below
cleanWs disableDeferredWipeout: true, deleteDirs: true
forceCleanWS()
try {
def buildPaths = ""
childJobs.each {
Expand Down Expand Up @@ -1277,8 +1265,7 @@ def run_parallel_tests() {
triggerRerunJob(failedTests)
}
} finally {
// cleanWs() does not work in some cases, so set opts below
cleanWs disableDeferredWipeout: true, deleteDirs: true
forceCleanWS()
}
}
}
Expand All @@ -1304,4 +1291,17 @@ def getGitRepoBranch(ownerBranch, defaultOwnerBranch, repo) {
return actualRepoBranch
}

def forceCleanWS() {
try {
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
}
}

return this
21 changes: 18 additions & 3 deletions buildenv/jenkins/openjdk_tests
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ timestamps{
}
}


def runTest() {
try {
def retry_count = 0
def sleep_time = 180

if (params.PLATFORM.contains('zos')) {
/* Ensure correct CC env */
env._CC_CCMODE = '1'
Expand All @@ -295,7 +295,7 @@ def runTest() {
}
retry_count++
timeout(time: 1, unit: 'HOURS') {
cleanWs disableDeferredWipeout: true, deleteDirs: true
forceCleanWS()
}
sh "git clone -b ${SCM_GIT_BRANCH} ${SCM_GIT_REPO_VAL} aqa-tests"
}
Expand All @@ -311,7 +311,7 @@ def runTest() {
}
retry_count++
timeout(time: 1, unit: 'HOURS') {
cleanWs disableDeferredWipeout: true, deleteDirs: true
forceCleanWS()
}
checkout scm: [$class: 'GitSCM',
branches: [[name: "${scm.branches[0].name}"]],
Expand Down Expand Up @@ -420,3 +420,18 @@ def checkErrors(errorList) {
}
}
}


def forceCleanWS() {
try {
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
}
}

0 comments on commit 8b4bdce

Please sign in to comment.