我想从Jenkins运行一个terraform文件我已经安装了Terraform插件版本1.0.9我在管道选项卡上创建一个新的管道项目我选择管道脚本并粘贴下面的脚本
node {
env.PATH += ":/opt/terraform_0.7.13/"
stage ('Terraform Plan') {
sh 'terraform plan -no-color -out=create.tfplan'
}
// Optional wait for approval
input 'Deploy stack?'
stage ('Terraform Apply') {
sh "terraform --version"
}
这是控制台输出
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Terraform Plan)
[Pipeline] sh
[aws_terraform] Running shell script
+ terraform plan -no-color -out=create.tfplan
/var/lib/jenkins-slave/workspace/ow/ow_eng/aws_terraform@tmp/durable-53622951/script.sh: line 2: terraform: command not found
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 127
Finished: FAILURE
terraform
二进制文件未安装在正在执行管道的jenkins从服务器上。必须安装二进制文件才能使插件正常工作