parameter - saviovettoor/DevOps-wiki GitHub Wiki
Valid parameter types are booleanParam, choice, file, text, password, run, or string.
pipeline {
agent any
parameters {
booleanParam(name: 'booleanFlag', defaultValue: true, description: '')
choice( name: 'choiceFlag', choices: "Apple\nOrange\nWaterMelon", description: '' )
text(name: 'BIOGRAPHY', defaultValue: '', description: 'Enter some information about the person')
password(name: 'PASSWORD', defaultValue: 'SECRET', description: 'Enter a password')
string(name: 'PERSON', defaultValue: 'Mr Jenkins', description: 'Who should I say hello to?')
file(name: "FILE", description:'contains list of projects to be build')
}
stages {
stage("Boolean") {
when {
expression { return booleanFlag ==~ /(?i)(Y|YES|T|TRUE|ON|RUN)/ }
}
steps {
echo "flag: ${params.booleanFlag}"
}
}
stage("Other") {
steps {
echo "flag: ${params.choiceFlag}"
echo "flag: ${params.FILE}"
echo "flag: ${params.BIOGRAPHY}"
echo "flag: ${params.PASSWORD}"
echo "flag: ${params.PERSON}"
}
}
}
}