詹金斯 'java.lang.IllegalStateException: There is no body to invoke'
Jenkins 'java.lang.IllegalStateException: There is no body to invoke'
我正在尝试 运行 来自 jenkins 管道的一些 terraform 命令。但我一直收到 'java.lang.IllegalStateException: There is no body to invoke'
我的 JenkinsFile 看起来像这样:
pipeline {
agent none
stages {
stage('stage') {
agent { node { label 'build-java11' } }
steps {
dir('./tf')
echo 'Terraform plan in progess..'
sh 'curl https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo | tee /etc/yum.repos.d/hashicorp.repo && yum install terraform -y'
sh 'terraform plan -var-file="/myfile.tfvars"'
}
}
}
}
通过在 dir()
之后放置方块 {}
找到答案。
例子
agent none
stages {
stage('TF') {
agent { node { label 'build-java11' } }
steps {
dir('tf/conf')
{
echo 'Terraform plan in progess..'
sh 'curl https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo | tee /etc/yum.repos.d/hashicorp.repo && yum install terraform -y'
sh 'terraform plan -var-file="is24-de-box.tfvars"'
}
}
}
}
}
我正在尝试 运行 来自 jenkins 管道的一些 terraform 命令。但我一直收到 'java.lang.IllegalStateException: There is no body to invoke'
我的 JenkinsFile 看起来像这样:
pipeline {
agent none
stages {
stage('stage') {
agent { node { label 'build-java11' } }
steps {
dir('./tf')
echo 'Terraform plan in progess..'
sh 'curl https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo | tee /etc/yum.repos.d/hashicorp.repo && yum install terraform -y'
sh 'terraform plan -var-file="/myfile.tfvars"'
}
}
}
}
通过在 dir()
之后放置方块 {}
找到答案。
例子
agent none
stages {
stage('TF') {
agent { node { label 'build-java11' } }
steps {
dir('tf/conf')
{
echo 'Terraform plan in progess..'
sh 'curl https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo | tee /etc/yum.repos.d/hashicorp.repo && yum install terraform -y'
sh 'terraform plan -var-file="is24-de-box.tfvars"'
}
}
}
}
}