def withEnvironment(closure) {
def returnVal = null
def workdir= "${System.currentTimeMillis()}"
sh returnStdout: true, script: "mkdir -p ${workdir}"
withEnv(["ROOT=${pwd()}/${workdir}",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin"
]) {
dir("${workdir}") {
git branch: source_branch(), credentialsId: credentialsId, url: gitUrl
returnVal = closure();
}
}
sh returnStdout: true, script: "rm -rf ${workdir}"
return returnVal
}
def git_last_tag() {
sh
Jenkins Script
最新推荐文章于 2024-08-16 07:49:10 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)