I want to use some common value across different conditions in post section of pipeline hence I tried following -
1.
post {
script {
def variable = "<some dynamic value here>"
}
failure{
script{
"<use variable here>"
}
}
success{
script{
"<use variable here>"
}
}
}
2
post {
def variable = "<some dynamic value here>"
failure{
script{
"<use variable here>"
}
}
success{
script{
"<use variable here>"
}
}
}
But it results into compilation error.
Can you please suggest how I can declare a variable in post
section which can be used across conditions?