自上次成功构建詹金斯管道以来,如何获得更改?

自上次成功构建詹金斯管道以来,如何获得更改?,第1张

自上次成功构建詹金斯管道以来,如何获得更改?

好吧,我设法把一些东西凑在一起。我敢肯定,您可以更好地迭代数组,但这是我现在所拥有的:

node('Android') {  passedBuilds = []  lastSuccessfulBuild(passedBuilds, currentBuild);  def changeLog = getChangeLog(passedBuilds)  echo "changeLog ${changeLog}"}def lastSuccessfulBuild(passedBuilds, build) {  if ((build != null) && (build.result != 'SUCCESS')) {      passedBuilds.add(build)      lastSuccessfulBuild(passedBuilds, build.getPreviousBuild())   }}@NonCPSdef getChangeLog(passedBuilds) {    def log = ""    for (int x = 0; x < passedBuilds.size(); x++) {        def currentBuild = passedBuilds[x];        def changeLogSets = currentBuild.rawBuild.changeSets        for (int i = 0; i < changeLogSets.size(); i++) { def entries = changeLogSets[i].items for (int j = 0; j < entries.length; j++) {     def entry = entries[j]     log += "* ${entry.msg} by ${entry.author} n" }        }    }    return log;  }


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5127878.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-17
下一篇 2022-11-17

发表评论

登录后才能评论

评论列表(0条)

保存