【问题标题】:using “findFiles” in a Jenkinsfile with pattern matching more then one file by suffix , using glob ( ant glob)在 Jenkinsfile 中使用“findFiles”,通过后缀匹配多个文件,使用 glob (ant glob)
【发布时间】:2021-01-10 08:13:08
【问题描述】:

我尝试在 Jenkinsfile 中使用 ant glob 和“findFiles”捕获 2 种文件类型 在我的目录中,我有:

xxx.ipa
foo.plist

当我这样做时:

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

我什么都没有,但是当我这样做时:

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

我确实得到了 xxx.ipa 文件。

我正在使用 jenkins findfiles,它使用 ant glob 按模式捕获文件
https://www.jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#findfiles-find-files-in-the-workspace

【问题讨论】:

    标签: jenkins jenkins-pipeline jenkins-plugins


    【解决方案1】:

    问题在于glob 不是正则表达式,而是Ant Style pattern。 因此,您要么必须单独捕获文件,要么可以使用带有 grepfind 的 shell 脚本,例如:

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

    【讨论】:

    • @user63898 你知道怎么做吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-04-12
    • 2011-08-31
    • 2015-04-15
    • 1970-01-01
    • 2016-05-03
    • 1970-01-01
    • 2023-02-23
    相关资源
    最近更新 更多