[英]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.