Try-catch block in Jenkins pipeline script

后端 未结 5 1681
有刺的猬
有刺的猬 2020-12-13 18:16

I\'m trying to use the following code to execute builds, and in the end, execute post build actions when builds were successful. Still, I get a MultipleCompilationErrorsExce

5条回答
  •  我在风中等你
    2020-12-13 19:02

    try/catch is scripted syntax. So any time you are using declarative syntax to use something from scripted in general you can do so by enclosing the scripted syntax in the scripts block in a declarative pipeline. So your try/catch should go inside stage >steps >script.

    This holds true for any other scripted pipeline syntax you would like to use in a declarative pipeline as well.

提交回复
热议问题