From b3b806076ae695af3830d646564c60db830d6579 Mon Sep 17 00:00:00 2001 From: Chase Qi Date: Mon, 28 May 2018 04:37:10 -0400 Subject: 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 --- erp-test-automation/builders-matrix.sh | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 erp-test-automation/builders-matrix.sh (limited to 'erp-test-automation') 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 -- cgit v1.2.3