aboutsummaryrefslogtreecommitdiff
path: root/erp-test-automation
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2018-05-28 04:37:10 -0400
committerFathi Boudra <fathi.boudra@linaro.org>2018-06-06 09:23:29 +0000
commitb3b806076ae695af3830d646564c60db830d6579 (patch)
treee06da3d5105f82797e009f39b7eef331ee57b902 /erp-test-automation
parent8d90551f5384b667001213537fb506e2c1d712d9 (diff)
erp-test-automation: add matrix project
The existing erp-test-automation.yaml freestyle project is simple but has a potential issue. When it fails to provision or test one host, the related command will return non-zero exit code and ask for retry. As we have '-e' enabled in build script, non-zero exit will mark the job as failure and kill the job. This breaks the provision or testing on other hosts. It is possible to capture the exit code and decide what to do for the next step. In this way, we have to amend host group dynamically and pass it to test status monitor action. It is more complex then using matrix build. With matrix build, hosts will be separated completely. Change-Id: Idad8b006e053d5d288c121442a905b669b815268 Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'erp-test-automation')
-rwxr-xr-xerp-test-automation/builders-matrix.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/erp-test-automation/builders-matrix.sh b/erp-test-automation/builders-matrix.sh
new file mode 100755
index 0000000000..cfc6f965df
--- /dev/null
+++ b/erp-test-automation/builders-matrix.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+set -ex
+
+trap cleanup_exit INT TERM EXIT
+
+cleanup_exit()
+{
+ rm -f ${HOME}/.vault_pass_erp.txt
+}
+
+## Some build dependencies are pre-installed on the build host
+# dirmngr virtualenv git sshpass
+
+echo ${ANSIBLE_VAULT} > ${HOME}/.vault_pass_erp.txt
+
+rm -rf ${WORKSPACE}/*
+
+git clone --depth 1 https://github.com/Linaro/erp-test-automation
+cd erp-test-automation/erp-playbook
+
+## Setup environment
+virtualenv --python=/usr/bin/python2 erp-test-env
+. erp-test-env/bin/activate
+pip install -r requirements.txt
+
+# Provision image and run test
+ansible-galaxy install -p roles -r requirements.yml
+if [ "${BUILD_NUM}" = "latest" ]; then
+ ansible-playbook -l ${HOST} -e erp_installer_environment=${BUILD_ENV} -e erp_installer_distro=${BUILD_DISTRO} main.yml
+else
+ ansible-playbook -l ${HOST} -e erp_installer_environment=${BUILD_ENV} -e erp_build_number=${BUILD_NUM} -e erp_installer_distro=${BUILD_DISTRO} main.yml
+fi
+
+# Wait for tests to finish
+ansible-playbook -l ${HOST} wait-for-poweroff.yml