我想在名为“MyFolder”的子文件夹中存储名为“ myFiles ”的所有文件,无法弄清楚为什么这不起作用:
stash name: "mystash", includes: '**/*myFiles*'
我验证了这个文件存在,案例和名称是正确的,但存储仍然无法正常工作。当我取消暂停时,我只获得“MyFolder”并且它是空的。据我所知,stash使用ant glob语法?我的语法错了吗?
答案 0 :(得分:1)
我使用下面的管道测试并运行
node {
ansiColor('xterm') {
stage("test") {
sh 'mkdir bla && cd bla && touch blabmyFiles34 && touch nothing'
sh 'touch 12myFiles'
sh 'touch test'
sh 'touch 13myFiles'
sh 'touch 12myFiles3232'
sh 'ls -la'
stash name: "mystash", includes: '**/*myFiles*'
}
stage("files") {
sh 'rm -rf *'
unstash name: "mystash"
sh 'ls -la'
sh 'ls -la bla'
}
}
}
这是詹金斯的输出:
[Pipeline] node
Running on US-EAST-1Ubuntu (i-) in /home/ubuntu/workspace/test-stash
[Pipeline] {
[Pipeline] ansiColor
[Pipeline] {
[Pipeline] stage
[Pipeline] { (test)
[Pipeline] sh
[test-stash] Running shell script
+ mkdir bla
+ cd bla
+ touch blabmyFiles34
+ touch nothing
[Pipeline] sh
[test-stash] Running shell script
+ touch 12myFiles
[Pipeline] sh
[test-carlos-stash] Running shell script
+ touch test
[Pipeline] sh
[test-carlos-stash] Running shell script
+ touch 13myFiles
[Pipeline] sh
[test-carlos-stash] Running shell script
+ touch 12myFiles3232
[Pipeline] sh
[test-stash] Running shell script
+ ls -la
total 12
drwxrwxr-x 3 ubuntu ubuntu 4096 Feb 15 11:43 .
drwxrwxr-x 14 ubuntu ubuntu 4096 Feb 15 11:36 ..
-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 15 11:37 12myfiles
-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 15 11:43 12myFiles
-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 15 11:43 12myFiles3232
-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 15 11:43 13myFiles
drwxrwxr-x 2 ubuntu ubuntu 4096 Feb 15 11:43 bla
-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 15 11:43 test
[Pipeline] stash
Stashed 4 file(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (files)
[Pipeline] sh
[test-stash] Running shell script
+ rm -rf 12myFiles 12myFiles3232 12myfiles 13myFiles bla test
[Pipeline] unstash
[Pipeline] sh
[test-stash] Running shell script
+ ls -la
total 12
drwxrwxr-x 3 ubuntu ubuntu 4096 Feb 15 11:43 .
drwxrwxr-x 14 ubuntu ubuntu 4096 Feb 15 11:36 ..
-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 15 11:43 12myFiles
-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 15 11:43 12myFiles3232
-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 15 11:43 13myFiles
drwxrwxr-x 2 ubuntu ubuntu 4096 Feb 15 11:43 bla
[Pipeline] sh
[test-stash] Running shell script
+ ls -la bla
total 8
drwxrwxr-x 2 ubuntu ubuntu 4096 Feb 15 11:43 .
drwxrwxr-x 3 ubuntu ubuntu 4096 Feb 15 11:43 ..
-rw-rw-r-- 1 ubuntu ubuntu 0 Feb 15 11:43 blabmyFiles34
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // ansiColor
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
是你在寻找什么?