如何失败的Jenkins管道阶段的状态,阶段完成后成功。请帮忙谢谢
def build_job_result = [:]
pipeline {
agent any
stages {
stage('1') {
steps {
build_job_result = build job: "jobName", wait: false
}
}
stage('2') {
steps {
def jobName = build_job_result.getFullDisplayName().split()[0]
def jobNumber = build_job_result.number
def jobStatus = build_job_result.getStatus()
if (jobStatus == failed) {
stage('1').status = failed
}
}
}
}
}
}
1条答案
按热度按时间ezykj2lf1#
一旦你离开了一个阶段,你就不能改变阶段状态AFAIK。更好的选择是将您的Pipeline重构为如下所示。基本上,并行运行您的阶段。