我在本地机器的 Jenkins 安装上运行它。我试过这个现在有用。 shell 命令失败,因为它在 /usr/local/bin
node {
withEnv(["PATH = /usr/local/bin:$env.PATH"]) {
// The pipeline will fail it can't find terraform
stage("Check terraform") {
sh "terraform --version"
}
}
}
答案 0 :(得分:0)
在 the documentation 中,使用 =
的 withEnv
周围没有空格。
你想要的是
node {
withEnv(["PATH=/usr/local/bin:$env.PATH"]) {
stage("Check terraform") {
sh "terraform --version"
}
}
}