I have a Jenkinsfile instance using ansible-playbook to deploy webmachine.
I need to specified ansible-playbook parameters more than one at once.
I got
WorkflowScript: 25: Multiple occurrences of the parameters section
my jenkinsfile like this,
pipeline {
agent none
stages {
stage('docker-compose up') {
input {
message "Should we continue?"
ok "Yes, do it!"
parameters {
string(name: 'KIBANA_TAG', defaultValue: '', description: 'input tag for ansible command.')
}
parameters {
string(name: 'FLUENT_TAG', defaultValue: '', description: 'input tag for ansible command.')
}
parameters {
string(name: 'ES_TAG', defaultValue: '', description: 'input tag for ansible command.')
}
parameters {
string(name: 'HOST', defaultValue: '', description: 'input tag for ansible command.')
}
}
steps {
sh "rd6-admin@qa ansible-playbook /tmp/qa/docker-compose-up.yml -e fluent_tag=${params.FLUENT_TAG} -e kibana_tag=${params.KIBANA_TAG} -e es_tag=${params.ES_TAG} -e host=${params.HOST}"
}
}
}
}
what part should i fix?
The comma separator is not working in version 2.222.1. I removed the comma and it is now working.
parameters {
string(name: 'KIBANA_TAG', defaultValue: 'default', description: 'input tag for ansible command.')
string(name: 'FLUENT_TAG', defaultValue: 'default', description: 'input tag for ansible command.')
string(name: 'ES_TAG', defaultValue: 'default', description: 'input tag for ansible command.')
string(name: 'HOST', defaultValue: 'default', description: 'input tag for ansible command.')
}
parameters {
string(name: 'KIBANA_TAG', defaultValue: 'default', description: 'input tag for ansible command.')
string(name: 'FLUENT_TAG', defaultValue: 'default', description: 'input tag for ansible command.')
string(name: 'ES_TAG', defaultValue: 'default', description: 'input tag for ansible command.')
string(name: 'HOST', defaultValue: 'default', description: 'input tag for ansible command.')
}
Try this. Multiple occurrences of the parameters section means that there is only one parameters{} allowed and you have to place your parameters inside there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With