Open wuhuizuo opened 2 years ago
I'm not familiar with java. @j3t
Do you have some examples where this could be useful? For git, you could just use shallow clones instead.
I have the example, most is to save binary building time.
I have the example, most is to save binary building time.
I get what you want and I guess we can make it happen but for me the use case is still not clear. Do you have a concrete example?
I have the example, most is to save binary building time.
I get what you want and I guess we can make it happen but for me the use case is still not clear. Do you have a concrete example?
In test pipeline, design steps:
stage("prepare binary") {
steps {
cache(path: "bin/dir1", key:"uniq-key", onlyRunWhenMiss: true) {
sh "./build.sh" // it take several minutes or hours
}
cache(path: "bin/dir2", key:"uniq-key", onlyRunWhenMiss: true) {
sh "./build2.sh" // it take several minutes or hours
}
}
}
stage("test") {
steps {
sh "./run-test.sh" // using bin/dir1 and /bin/dir2
}
}
I'm not sure, I mean you could just add a condition like
...
cache(path: "bin/dir1", key:"uniq-key") {
sh "[ ! -d "bin/dir1" ] && ./build.sh"
}
...
or you could extend the build.sh
so that the resources are not regenerated if they already exist?
Also, what is about restore keys? They are ignored in this context, right?
New feature
The block will not run. if
key
exist: