How to pass ${CHANGES} to downstream job?

ぐ巨炮叔叔 提交于 2019-12-01 05:58:21

You can get the change set or the values you need with groovy script:

def jenkins = Jenkins.getInstance()
def job = jenkins.getItem(jobName)
def bld = job.getBuildByNumber(buildNumber)
def changeSet = bld.getChangeSet()

then it dependents on which scm plugin you use, for example with git-plugin you can:

get the revision of each change:

changeSet.each{
    println it.getRevision()
}

get message for each change:

changeSet.each{
    println it.getMsg()
}

get affected paths:

changeSet.each{
   println it.getAffectedPaths()
}

get author name:

changeSet.each{
    println it.getAuthorName()
}

and many more actions

Peter Schuetze

I saw a All Changes Plugin which updates the changes page. Don't know if $Changes gets populated with that info as well.

If that doesn't work, have a look at Get access to Build Changelog in Jenkins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!