Skip to content

Commit

Permalink
Ensure any old openjdk build directory is removed before building (#1030
Browse files Browse the repository at this point in the history
)

Signed-off-by: Andrew Leonard <[email protected]>
Co-authored-by: Martijn Verburg <[email protected]>
  • Loading branch information
andrew-m-leonard and karianna authored May 15, 2024
1 parent b1296a0 commit 31b6c33
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pipelines/build/common/openjdk_build_pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1533,6 +1533,24 @@ class Build {
}
}

// Always clean any previous "openjdk_build_dir" output, possibly from any previous aborted build..
try {
try {
context.timeout(time: buildTimeouts.NODE_CLEAN_TIMEOUT, unit: 'HOURS') {
if (context.WORKSPACE != null && !context.WORKSPACE.isEmpty()) {
context.println 'Removing workspace openjdk build directory: ' + openjdk_build_dir
context.sh(script: 'rm -rf ' + openjdk_build_dir)
} else {
context.println 'Warning: Unable to remove workspace openjdk build directory as context.WORKSPACE is null/empty'
}
}
} catch (FlowInterruptedException e) {
throw new Exception("[ERROR] Remove workspace openjdk build directory timeout (${buildTimeouts.NODE_CLEAN_TIMEOUT} HOURS) has been reached. Exiting...")
}
} catch (e) {
context.println "[WARNING] Failed to remove workspace openjdk build directory: ${e}"
}

try {
context.timeout(time: buildTimeouts.NODE_CHECKOUT_TIMEOUT, unit: 'HOURS') {
if (useAdoptShellScripts) {
Expand Down

0 comments on commit 31b6c33

Please sign in to comment.