好吧,我设法把一些东西凑在一起。我敢肯定,您可以更好地迭代数组,但这是我现在所拥有的:
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; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)