我只想部署更改的文件,所以我在jenkinsfile中有这个脚本
def ChangeStes(){
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}"
if (file.path.contains('functions/ec2-instances')) {
// NEVER ENTERING HERE
}
}
}
}
}
每次都能成功完成构建,并且不处理文件路径中的条件。
该如何解决?我有很多If条件。