Post failure block in Jenkinsfile is not working

前端 未结 2 1454
不知归路
不知归路 2021-01-12 10:56

I\'m trying a post failure action with a parallel step but it never works.

This is my Jenkinsfile:

pipeline {
  agent any
  stages {
    stage(\"tes         


        
2条回答
  •  长发绾君心
    2021-01-12 11:20

    Just in case someone else also made the same stupid mistake I did, don't forget the post block needs to be inside the pipeline block.

    i.e. This is apparently valid, but (obviously) won't work:

    pipeline {
      agent { ... }
      stages { ... }
    }
    // WRONG!
    post {
      always { ... }
    }
    

    This is what's correct:

    pipeline {
      agent { ... }
      stages { ... }
      post {
        always { ... }
      }
    }
    

提交回复
热议问题