How to use it in a declarative pipeline:
pipeline { agent any parameters { base64File 'THEFILE' } stages { stage('Example') { steps { withFileParameter('THEFILE') { sh 'cat $THEFILE' } } } } }
allowNoFile
. In this case your Pipeline must take into account the possibility that the file does not exist:
pipeline { agent any parameters { base64File 'THEFILE' } stages { stage('Example') { steps { withFileParameter(name:'THEFILE', allowNoFile: true) { sh 'if [ -f "$THEFILE" ]; then cat $THEFILE; fi' } } } } }