using “findFiles” in a Jenkinsfile with pattern matching more then one file by suffix , using glob ( ant glob)

Viewed 1951

i try to capture 2 file types using ant glob and “findFiles” in a Jenkinsfile in my dir i have :

xxx.ipa
foo.plist

when i do :

files = findFiles(glob: '**/*.[ipa|plist]') 
or 
files = findFiles(glob: '**/*.ipa|*.plist') 

I'm getting none, but when i do :

files = findFiles(glob: '**/*.ipa') 

I do getting the xxx.ipa file .

im using jenkins findfiles which using ant glob to capture files by pattern
https://www.jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#findfiles-find-files-in-the-workspace

1 Answers

The problem is that glob is not a regex but Ant Style pattern. So you either have to capture files separately or you could use a shell script with grep or find instead, e.g.:

def files = sh(returnStdout: true, script: 'find . -name "*.ipa" -o -name "*.plist"')
Related