Trigger pipeline A form pipeline B in Jenkins if there is no last successful build of pipeline A

huangapple go评论65阅读模式
英文:

Trigger pipeline A form pipeline B in Jenkins if there is no last successful build of pipeline A

问题

我想从管道B中触发管道A,具体取决于管道A上一次成功构建的某些环境变量的值(如果存在)。我该如何在管道B中实现这个目标。

英文:

There are two Jenkins pipelines A and B. I want to trigger pipeline A from B depending on the values of certain env variables of last successful build of pipeline A (if it exists). How can I achieve this form pipeline B.

答案1

得分: 1

你可以使用Jenkins-api来将最后一次成功构建的结果存储在变量中,例如:

curl --user {用户名}:{密码} http://{URL}/job/{任务名称}/lastSuccessfulBuild/api/json

然后在流水线B的开头使用'if'条件。

英文:

you can use Jenkins-api to collect the last success build in variable
like,

> curl --user {username}:{password} http://{URL}/job/{JOB-NAME}/lastFailedBuild/api/json

then use 'if' condition in first of all in pipeline B.

huangapple
  • 本文由 发表于 2023年7月18日 04:22:56
  • 转载请务必保留本文链接:https://go.coder-hub.com/76707848.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定