git中的
。
我在git的主分支和主分支中添加了用于windows和linux实例创建的ec2.tf
pipeline{
agent any
tools{
terraform 'terra'
}
stages{
stage('Git checkout'){
steps{
//
}
}
stage('Terraform Init'){
steps{
sh label: '', script:'terraform init'
}
}
stage('Terraform apply'){
steps{
sh label:'',script:'terraform apply --auto-approve'
}
}
}
}期望的输出仅仅是在git中创建一个分支,用户在运行jenkins管道时应该根据自己的选择手动选择linux和windows的ami id,我该怎么做呢?
任何建议都非常感谢!
发布于 2022-01-21 09:09:50
这行得通
agent any
tools{
terraform 'terra'
}
parameters{
choice(name:'ami', choices: ['Linux','Windows'])
choice(name:'Actions', choices:['apply','destroy'])
}
stages{
stage('Git checkout'){
steps{
//
}
}
stage('Terraform Init'){
steps{
sh label: '', script:'terraform init'
}
}
stage('Terraform apply'){
steps{
sh label:'',script:'terraform ${Actions} -var name="${ami}" --auto-approve'
}
}
}
}https://stackoverflow.com/questions/70792841
复制相似问题