[英]In Jenkinsfile get git files in current branch into a list (windows)
我正在使用声明性管道,并且想要获取在工作分支中添加/删除/修改的文件的列表。 我想将其放入常规列表变量中以用于后续条件。
环境-当前在Windows从站上使用git。
https://support.cloudbees.com/hc/zh-CN/articles/217630098-How-to-Access-Changelogs-in-a-Pipeline-Job 。
def changeLogSets = currentBuild.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]
echo "${entry.commitId} by ${entry.author} on ${new Date(entry.timestamp)}: ${entry.msg}"
def files = new ArrayList(entry.affectedFiles)
for (int k = 0; k < files.size(); k++) {
def file = files[k]
echo " ${file.editType.name} ${file.path}"
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.