-
Bug
-
Resolution: Not A Defect
-
Critical
-
None
-
Linux Ubuntu
I created a pipeline job with a Jenkins files that has the following content.. but I can't get controlFile to work correctly as it is a variable and fileExists doesnt seem to resolve it.
node {
def controlFile = '/path/somefile.txt'
if (fileExists(controlFile)) {
echo '${controlFile} exists.'
} else {
echo '${controlFile} missing. Will try to mount'
sh 'mount /path/server/extFs'
if (fileExists(controlFile)) {
echo '${controlFile} exists after mount. Continue...'
} else {
error: '${controlFile} still missing. Will now fail the job.'
}
}
}