DSL 生成的 copyArtifacts 作业示例

example of a DSL generated copyArtifacts job

我正在尝试使用 DSL 生成一个使用 copyArtifacts 的作业。我已经能够使用以下方法生成基本的 Copy artifact from another project

job('DSL-AgreegateArtifacts') {
  steps {
    copyArtifacts( 'Template-DSPL_RPub' )
  }
}

但是我还需要能够指定 Which buildArtifacts to copyTarget directory。我不清楚如何使用 Closure copyArtifactClosure 来指定此信息?我还没有找到任何例子。

copyArtifacts 的作业 DSL 参考中有一个示例:

job('example') {
    steps {
        copyArtifacts('upstream') {
            includePatterns('*.xml', '*.properties')
            targetDirectory('files')
            buildSelector {
                latestSuccessful(true)
            }
        }
    }
}