我正在尝试使用以下 jenkins 插件将前端应用程序构建工件复制到后续作业。
应用程序工件输出到以下目录:
/build
/test
/js
/css
404.html
index.html
所以我将以下内容放入后续工作的 Jenkinsfile 中:
script {
try {
env.FRONT_BRANCH=params.FRONT_BRANCH
copyArtifacts(projectName: "../front-app/", selector: specific(params.FRONT_BUILD_NO), filter: 'build/**/*', target: 'front', fingerprintArtifacts: false)
} catch (hudson.AbortException e) {
println(e)
}
sh 'ls front'
}
...
但是,控制台输出在这里:
[Pipeline] sh
+ ls front
build
我期望以下输出结果:
[Pipeline] sh
+ ls front
test
js
css
404.html
index.html
我不想复制构建目录,它是工件的根目录。
在我自己的一个项目中,我正在使用类似的解决方案,但我使用的是 jenkins 内置 stash/unstash 选项。
您的问题描述看起来与为您提供的用例 stash 和 unstash 非常相似。