I'm looking to pass $options
which is a string parameter in my Jenkinsfile. Below is my Jenkinsfile.
I get this error when I run the pipeline: java.lang.NullPointerException: Cannot get property '$options' on null object
. What am I missing?
pipeline {
agent {
docker {
image 'babylon_ansible:latest'
args '-u root'
}
}
stages {
stage('ansible playbook') {
steps {
script {
withCredentials([string(credentialsId: 'babylondumpspwd', variable: 'db_pass')]) {
sh 'pwd'
sh 'babylondumps' '$options`
}
}
}
}
}
}
CodePudding user response:
You can access the parameter with params.options
and call sh
with
sh "babylondumps ${params.options}"