Commit 31cafe6d authored by daidekun's avatar daidekun

count

parent 82b83ee4
......@@ -32,19 +32,23 @@ def call(body) {
stage('Deploy') {
arr_machines = machines.split(",")
machines_list = _utils.partition(arr_machines, 1)
count = arr_machines.count / 2
echo count
machines_list = _utils.partition(arr_machines, count)
echo machines_list
sh "ansible-playbook /etc/ansible/nginx_remove.yml -e project_name=${envType}.${projectName} -e data_center=${dataCenter} -e machines=${machines} -vv"
for (machine in machines_list) {
sh "ansible-playbook /etc/ansible/nginx_remove.yml -e project_name=${envType}.${projectName} -e data_center=${dataCenter} -e machines=${machine} -vv"
env.RELEASE_ACTION = input message: '请选择下一步部署动作', ok: '确认',
parameters: [choice(name: 'RELEASE_SCOPE', choices: 'Deploy\nRollback', description: '请谨慎选择你要进行的操作')]
env.RELEASE_ACTION = input message: '请选择下一步部署动作', ok: '确认',
parameters: [choice(name: 'RELEASE_SCOPE', choices: 'Deploy\nRollback', description: '请谨慎选择你要进行的操作')]
if (env.RELEASE_ACTION == "Deploy") {
sh "ansible-playbook /etc/ansible/${action}.yml -e project_name=${envType}.${projectName} -e data_center=${dataCenter} machines=${machines} -vv"
}else{
sh "ansible-playbook /etc/ansible/nginx_add.yml -e project_name=${envType}.${projectName} -e data_center=${dataCenter} machines=${machines} -vv"
if (env.RELEASE_ACTION == "Deploy") {
sh "ansible-playbook /etc/ansible/${action}.yml -e project_name=${envType}.${projectName} -e data_center=${dataCenter} machines=${machine} -vv"
}else{
sh "ansible-playbook /etc/ansible/nginx_add.yml -e project_name=${envType}.${projectName} -e data_center=${dataCenter} machines=${machine} -vv"
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment