So I have the case that I need to populate findfiles with files from more than one Dir
FILES = steps.findFiles(glob: "${FILE}/*.zip")
then I need to go to another folder and update it
FILES = steps.findFiles(glob: "${AnotherFilePath}/*.zip")
End goal is to iterate over the files and for each file do something. e.g
for(file in FILES) {
I really want to get away from bash but is it possible to do that Jenkins Groovy way? Can u populate Files Variable?
CodePudding user response:
you could use collectMany groovy method that executes closure for every item in initial list and joins result into one array
def FILES = [FILE, AnotherFilePath].collectMany{ steps.findFiles(glob: "${it}/*.zip") }