我可以让我的master分支作业每小时运行一次,如下所示:
String cron_string = BRANCH_NAME == "master" ? "@hourly" : ""
pipeline {
agent none
triggers { cron(cron_string) }
stages {
// do something
}
}
但是我想要每小时运行的某些特定行为-就像仅在每小时cron触发运行中运行某些阶段一样。
有什么方法可以确定管道内的cron计划是否触发了多分支作业?
currentBuild.getBuildCauses()
应该管用。
https://opensource.triology.de/jenkins/pipeline-syntax/globals#currentBuild
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句