Issue
In a declarative pipeline, I can specify the parameter that the pipeline expects right in the pipeline script like so:
pipeline {
parameters([
string(name: 'DEPLOY_ENV', defaultValue: 'TESTING' )
])
}
is it possible do to in a scripted pipline? I know I can do this :
BUT, IS IT POSSIBLE TO DO THIS:
node{
parameters([
string(name: 'DEPLOY_ENV', defaultValue: 'TESTING' )
])
}
Solution
I found a solution by experimentation so want to share it:
properties(
[
parameters([
string(defaultValue: '/data', name: 'Directory'),
string(defaultValue: 'Dev', name: 'DEPLOY_ENV')
])
]
)
node {
// params.DEPLOY_ENV ...
}
Answered By - Greg Bala
Answer Checked By - Candace Johnson (JavaFixing Volunteer)