如何在管道脚本中为阶段定义执行顺序?

时间:2019-07-16 08:52:59

标签: jenkins jenkins-pipeline workflow execution stage

在管道脚本中,我按执行顺序分为三个阶段。

pipeline {
stages {
stage ("check") {... //whatever code}         --> executes first
stage ("deploytoWAS") {... //whatever code}   --> executes second
stage ("EmailTeam") {... //whatever code}   --> executes third

我有布尔参数$ {params.mycheckbox},当选中/ true时,该参数会将以下阶段的执行顺序更改为:

stage ("check") {... //whatever code}         --> executes first
stage ("EmailTeam") {... //whatever code}   --> executes second
stage ("deploytoWAS") {... //whatever code}   --> executes third

我知道可以使用if条件来完成此操作,但是我不确定管道脚本的语法以及是否有更好的解决方案。

请求建议。

0 个答案:

没有答案