I am getting mad about the following pipeline code, as it does not do what I expect. Does anyone have an idea what I am doing wrong?
Here is my pipeline code to define the parameter
pipeline {
agent any
parameters { booleanParam(name: 'bForceCheckout', defaultValue: false, description: '') }
...
And here the stage itself
stage('SVN Checkout') {
// Get code from SVN repository
steps {
script {
// If project is not yet checked out, setup checkout structure, i.e. which
// folders will be checked out and which will not be checked out
retry (5) {
try {
def svnInfoError = bat (returnStatus: true, script: "svn info ${projectName}")
// bForceCheckout has to be set as parameter in the job
println "---> " + ((svnInfoError != 0) || bForceCheckout)
if ((svnInfoError != 0) || bForceCheckout) {
println "svnInfoError: " + svnInfoError
println "bForceCheckout: " + bForceCheckout
timeout(activity: true, time: 90, unit: 'MINUTES') {
// Clean up
deleteDir ()
... some SVN related stuff ...
}
}
} catch (Exception ex) {
// Clean up
deleteDir ()
println(ex.toString());
error ("SVN checkout: directory structure could not be set up")
}
}
}
}
}
And here is the console output. As you can see, svnInfoError and bForceCheckout are 0 / false, but the part in the if condition still get executed...
12:51:22
[Pipeline] echo
12:51:22 --->false
[Pipeline] echo
12:51:23 svnInfoError: 0
[Pipeline] echo
12:51:23 bForceCheckout: false
[Pipeline] timeout
12:51:23 Timeout set to expire after 1 hr 30 min without activity
[Pipeline] {
[Pipeline] deleteDir
[Pipeline] bat
12:55:21