I have set up Jenkins, but I would like to find out what files were added/changed between the current build and the previous build. I\'d like to run some long running tests
I tried to add that to comments but code in comments is no way:
Just want to prettify code from heroin's answer:
def changedFiles = []
def changeLogSets = currentBuild.changeSets
for (entries in changeLogSets) {
for (entry in entries) {
for (file in entry.affectedFiles) {
echo "Found changed file: ${file.path}"
changedFiles += "${file.path}"
}
}
}
Keep in mind for some cases git plugin returns empty changeSet, like:
Refer to https://issues.jenkins-ci.org/browse/JENKINS-26354 for more details.