Skip to content

Commit

Permalink
Workspace and outDir directory validation (#481)
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Behm <[email protected]>
  • Loading branch information
dennis-behm authored Mar 7, 2024
1 parent 0d533dc commit fb75b54
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,14 @@ def populateBuildProperties(def opts) {
// assert workspace
buildUtils.assertBuildProperties('workspace,outDir')

// validate tht workspace and outDir folders exist
[props.workspace, props.outDir].each { workDirectory ->
if (!(new File (workDirectory).exists())) {
println "!! The specified folder $workDirectory does not exist. Build exits."
System.exit(1)
}
// Validate that workspace exists
if (!(new File (props.workspace).exists())) {
println "!! The specified workspace folder ${props.workspace} does not exist. Build exits."
System.exit(1)
}

if (!(new File(props.outDir).canWrite())) {
// Check read/write permission of specified out/log dir if already existing
if (new File (props.outDir).exists() && !(new File(props.outDir).canWrite())) {
println "!! User does not have WRITE permission to work output directory ${props.outDir}. Build exits."
System.exit(1)
}
Expand Down

0 comments on commit fb75b54

Please sign in to comment.