path: root/build-gluster-org/scripts/
diff options
authordkhandel <dkhandel@localhost.localdomain>2018-06-21 14:30:46 +0530
committerdkhandel <dkhandel@localhost.localdomain>2018-06-21 15:57:39 +0530
commit4ff6c1f6b848e5ca76ec82194ef67e9fb507db08 (patch)
treea2b4359ade6436e795f952be342b1dddb158381a /build-gluster-org/scripts/
parent72a2c63590d18658c6ac6d4186a7497ceb81c213 (diff)
Exit the code with return value $ret
Fail the build if there is any failed test with exit code $ret and copy the failed test logs to Change-Id: If4dc1c809311b609d2babe2b04dd7dd799460d6e Signed-off-by: Deepshikha Khandelwal <>
Diffstat (limited to 'build-gluster-org/scripts/')
1 files changed, 14 insertions, 12 deletions
diff --git a/build-gluster-org/scripts/ b/build-gluster-org/scripts/
index a25c127..a3b05b7 100644
--- a/build-gluster-org/scripts/
+++ b/build-gluster-org/scripts/
@@ -4,16 +4,18 @@ MAX_ATTEMPTS=3
# create and activate virtual env
virtualenv env
-source env/bin/activate
+. env/bin/activate
# create SSH key pair of 4096 bits to use it for instances at Rackspace
-ssh-keygen -f ${WORKSPACE}/key -t rsa -b 4096
+ssh-keygen -f "${WORKSPACE}"/key -t rsa -b 4096
# Install dependencies
pip install pyrax ansible
-/opt/qa/distributed-tests/ create -n ${MACHINES_COUNT}
-for retry in `seq 1 $MAX_ATTEMPTS`
+#create the server maachines
+/opt/qa/distributed-tests/ create -n "${MACHINES_COUNT}"
+for retry in $(seq 1 $MAX_ATTEMPTS)
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i hosts --private-key=key /opt/qa/distributed-tests/distributed-server.yml -u root
@@ -26,15 +28,15 @@ done
# run the script of distributed-test
-if [ $ret -eq 0 ]; then
+#delete the server machines
+/opt/qa/distributed-tests/ delete
+if [ $ret -ne 0 ]; then
# Create tar file from all the failed test log files generated in /tmp
- tar -czf $WORKSPACE/failed-tests-logs.tgz /tmp/*.log
- scp -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -i $LOG_KEY failed-tests-logs.tgz "$JOB_NAME-logs-$BUILD_ID.tgz" || true;
+ tar -czf "$WORKSPACE"/failed-tests-logs.tgz /tmp/*.log
+ scp -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -i "$LOG_KEY" failed-tests-logs.tgz "$JOB_NAME-logs-$BUILD_ID.tgz" || true;
echo "Failed tests logs stored in$JOB_NAME-logs-$BUILD_ID.tgz"
- # if test runs are successful, delete all the machines
- /opt/qa/distributed-tests/ delete
- exit 0
exit $ret
+ exit 0