Great, thanks for your reply and here is the script which iam facing error. So, without adding boolean parameter it is working fine but once added its throws error in console output. Can you help me how to resolve this issue and hot to commit the reports in pipeline and if you have the script you can share to me. iam new to the scripting…Thanks a lot for replying.
pipeline {
agent any
stages {
stage(‘Parameters’) {
steps {
script {
properties([
parameters([
[$class: ‘BooleanParameter’,
name: ‘SVN_Commit’,
defaultValue: false,
description: ‘Check to commit to SVN’
],
[$class: ‘ChoiceParameter’,
choiceType: ‘PT_SINGLE_SELECT’,
description: ‘Select the Environemnt from the Dropdown List’,
filterLength: 1,
filterable: false,
name: ‘Env’,
script: [
$class: ‘GroovyScript’,
fallbackScript: [
classpath: ,
sandbox: false,
script: “return[‘Could not get The environemnts’]”
],
script: [
classpath: ,
sandbox: false,
script: “return[‘dev’,‘stage’,‘prod’]”
]
]
],
[$class: ‘CascadeChoiceParameter’,
choiceType: ‘PT_CHECKBOX’,
description: ‘Select the Units from the List’,
name: ‘Units’,
referencedParameters: ‘Env’,
script:
[$class: ‘GroovyScript’,
fallbackScript: [
classpath: ,
sandbox: false,
script: “return[‘Could not get Environment from Env Param’]”
],
script: [
classpath: ,
sandbox: false,
script: ‘’’
if (Env.equals(“dev”)){
return[“Unit1”, “Unit2”, “Unit3”]
}
else if(Env.equals(“stage”)){
return[“Unit4”, “Unit5”, “Unit6”]
}
else if(Env.equals(“prod”)){
return[“Unit7”, “Unit8”, “Unit9”]
}
‘’’
]
]
],
])
])
}
}
}
stage('Unit1'){
when {
expression { units.contains("Unit1") }
}
steps {
echo '############################################ UNIT-1 ############################################'
}
}
stage('Unit2'){
when {
expression { units.contains("Unit2") }
}
steps {
echo '############################################ UNIT-2 ############################################'
}
}
stage('Unit3'){
when {
expression { units.contains("Unit3") }
}
steps {
echo '############################################ UNIT-3 ############################################'
}
}
stage('Unit4'){
when {
expression { units.contains("Unit4") }
}
steps {
echo '############################################ UNIT-4 ############################################'
}
}
stage('Unit5'){
when {
expression { units.contains("Unit5") }
}
steps {
echo '############################################ UNIT-5 ############################################'
}
}
stage('Unit6'){
when {
expression { units.contains("Unit6") }
}
steps {
echo '############################################ UNIT-6 ############################################'
}
}
stage('Unit7'){
when {
expression { units.contains("Unit7") }
}
steps {
echo '############################################ UNIT-7 ############################################'
}
}
stage('Unit8'){
when {
expression { units.contains("Unit8") }
}
steps {
echo '############################################ UNIT-8 ############################################'
}
}
stage('Unit9'){
when {
expression { units.contains("Unit9") }
}
steps {
echo '############################################ UNIT-9 ############################################'
}
}
stage('SVN Commit'){
when {
expression { params.SVN_Commit == true }
}
steps {
echo 'Committing changes to SVN...'
// Add your SVN commit command here
}
}
}
}