Checks if the given file exists on the current node.
Returns true | false
.
This step must be run inside a node
context:
# Declarative Syntax
stage ('Check for existence of index.html') {
agent any # Could be a top-level directive or a stage level directive
steps {
script {
if (fileExists('src/main/rersources/index.html') {
echo "File src/main/rersources/index.html found!"
}
}
}
}
With the Declarative Syntax, it must be run in a stage with a defined agent (e.g. different than `agent none`):
# Scripted Syntax
node {
if (fileExists('src/main/rersources/index.html') {
echo "File src/main/rersources/index.html found!"
}
}