i have a question on declarative pipeline scripting,am trying to set the variables dynamically depends on parameters passed before the stages start,say in environment block or node block
Just with one parameter, i wanted to construct the other variables dynamically with if condition at this moment,tried on both blocks(Environment ,Node )but no luck,as this needs to global i need this initialized before entering stages
pipeline {
environment {
stream_name = "${stream_name}"
user_id = "${user_id}"
currentBuild_displayName = "${currentBuild_displayName}"
GBE_ViewTag = "${DevWorkspace_name}"
script {
if ( ${Stream_name} == 'Allura_Main_Infra_PreInt') {
loadrule = "Infra-uInfra/Infra.loadrule"
}
}
}
agent {
node {
label 'CP'
customWorkspace 'D:\\RTC'
}
}