From 6e14eed1741da9964ff3ab05b4c049d9428dc129 Mon Sep 17 00:00:00 2001 From: Deepshikha khandelwal Date: Mon, 20 May 2019 18:12:10 +0530 Subject: Refactor the distributed regression scripts for AWS environment Change-Id: Icf1a8a7f593476dc3e1091db7a7f8f1a0094ab8e Signed-off-by: Deepshikha khandelwal --- build-gluster-org/jobs/distributed-regression.yml | 12 ++++++------ build-gluster-org/scripts/distributed-regression.sh | 18 ++++-------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/build-gluster-org/jobs/distributed-regression.yml b/build-gluster-org/jobs/distributed-regression.yml index 8ce6c3d..aa10816 100644 --- a/build-gluster-org/jobs/distributed-regression.yml +++ b/build-gluster-org/jobs/distributed-regression.yml @@ -33,9 +33,9 @@ description: Number of machines to launch name: MACHINES_COUNT - string: - default: 'ORD' + default: 'us-east-2' description: Rackspace region to launch instances - name: RAX_REGION + name: AWS_REGION builders: - shell: !include-raw: ../scripts/distributed-regression.sh @@ -49,10 +49,10 @@ wrappers: - timestamps - credentials-binding: - - username-password-separated: - credential-id: e423d7f9-edaf-45ea-aa8f-9c3f8e6563f1 - username: RAX_USERNAME - password: RAX_API_KEY + - amazon-web-services: + credential-id: bb013fcf-cda4-41b6-9c4a-e82c45681157 + access-key: AWS_ACCESS_KEY + secret-key: AWS_SECRET_KEY - file: credential-id: http_int_credential variable: LOG_KEY diff --git a/build-gluster-org/scripts/distributed-regression.sh b/build-gluster-org/scripts/distributed-regression.sh index d38b53d..a927575 100644 --- a/build-gluster-org/scripts/distributed-regression.sh +++ b/build-gluster-org/scripts/distributed-regression.sh @@ -13,32 +13,22 @@ virtualenv --system-site-packages env ssh-keygen -f "${WORKSPACE}"/key -t rsa -b 4096 # Install dependencies -pip install -I pyrax ansible +pip install -I boto boto3 ansible #create the server machines -ansible-playbook /opt/qa/distributed-tests/create-vm.yml -e COUNT=${MACHINES_COUNT} -e NAME=${JOB_NAME}-${BUILD_ID} -e PATH=${WORKSPACE} - -for retry in $(seq 1 $MAX_ATTEMPTS) -do - ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i hosts /opt/qa/distributed-tests/setup.yml -u root --skip-tags 'copy_logs' -e PATH=${WORKSPACE} - ret=$? - if [ $ret -eq 0 ]; then - break - fi - echo 'Attempting to run again...' -done +ansible-playbook /opt/qa/distributed-tests/distributed-setup.yml -e COUNT=${MACHINES_COUNT} -e NAME=${JOB_NAME}-${BUILD_ID} -e PATH=${WORKSPACE} -u centos --skip-tags 'copy_logs,terminate' # run the script of distributed-test /opt/qa/distributed-tests/run-distributed-test.py --n "${MACHINES_COUNT}" ret=$? #copy the logs from machines before deleting -ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i hosts /opt/qa/distributed-tests/setup.yml -u root --tags 'copy_logs' --private-key key +ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i hosts /opt/qa/distributed-tests/distributed-setup.yml -u centos --tags 'copy_logs' --private-key key #delete the server machines for retry in $(seq 1 $MAX_ATTEMPTS) do - ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i hosts /opt/qa/distributed-tests/delete-vm.yml + ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i hosts /opt/qa/distributed-tests/distributed-setup.yml -u centos --tags 'terminate' exit_code=$? if [ $exit_code -eq 0 ]; then break -- cgit