Попробуйте, как показано ниже:
def stageA_Fail = false
pipeline {
stages {
stage('A') {
steps {
script {
try {
// put all steps of stage A in try
}
catch() {
stageA_Fail = true
}
}
}
}
stage('B') {
when {expression {return stageA_Fail} }
steps {}
}
}
}