diff options
author | Chase Qi <chase.qi@linaro.org> | 2018-01-11 18:13:24 +0800 |
---|---|---|
committer | Fathi Boudra <fathi.boudra@linaro.org> | 2018-01-15 10:08:03 +0000 |
commit | 648b7a80c1a71edda37ca2eec289d226dcd86089 (patch) | |
tree | d8dec2b8468c7dcf5d1cbe8b29696fe4530c8a38 | |
parent | 296d147630ab2129757caebdbf01c4afc6ffb227 (diff) |
erp-test-automation: schedule weekly ERP testing
Add erp-test-automation project to provision image and run ERP tests
automatically, which can be trigged with HOSTS, BUILD_ENV and BUILD_NUM
parameters.
Add a trigger to run erp-test-automation weekly.
Change-Id: If6a545e93c3c2cfe33e1ce4dd94f5543b8a6a9b9
Signed-off-by: Chase Qi <chase.qi@linaro.org>
-rw-r--r-- | erp-test-automation.yaml | 39 | ||||
-rwxr-xr-x | erp-test-automation/builders.sh | 37 | ||||
-rw-r--r-- | trigger-erp-test-automation-weekly.yaml | 28 |
3 files changed, 104 insertions, 0 deletions
diff --git a/erp-test-automation.yaml b/erp-test-automation.yaml new file mode 100644 index 0000000000..7448b712be --- /dev/null +++ b/erp-test-automation.yaml @@ -0,0 +1,39 @@ +- job: + name: 'erp-test-automation' + display-name: 'ERP test automation' + project-type: freestyle + defaults: global + properties: + - authorization: + linaro: + - job-read + - job-extended-read + - job-build + - job-cancel + - build-discarder: + days-to-keep: 30 + num-to-keep: 30 + disabled: false + node: master + parameters: + - string: + name: HOSTS + default: 'cb-g0' + - string: + name: BUILD_ENV + default: 'staging' + - string: + name: BUILD_NUM + default: 'latest' + wrappers: + - timestamps + - credentials-binding: + - text: + credential-id: ANSIBLE_VAULT + variable: ANSIBLE_VAULT + builders: + - shell: + !include-raw: erp-test-automation/builders.sh + publishers: + - email: + recipients: 'chase.qi@linaro.org' diff --git a/erp-test-automation/builders.sh b/erp-test-automation/builders.sh new file mode 100755 index 0000000000..34d0f1528f --- /dev/null +++ b/erp-test-automation/builders.sh @@ -0,0 +1,37 @@ +#!/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 + +## Setup environment +virtualenv --python=/usr/bin/python2 erp-test-env +. erp-test-env/bin/activate +pip install ansible future requests + +cd erp-test-automation/erp-playbook + +# Provision image and run test +ansible-galaxy install -p roles -r requirements.yml +if [ "${BUILD_NUM}" = "latest" ]; then + ansible-playbook -l ${HOSTS} -e erp_debian_installer_environment=${BUILD_ENV} main.yml +else + ansible-playbook -l ${HOSTS} -e erp_debian_installer_environment=${BUILD_ENV} -e erp_build_number=${BUILD_NUM} main.yml +fi + +# Wait for tests to finish +ansible-playbook -l ${HOSTS} wait-for-poweroff.yml diff --git a/trigger-erp-test-automation-weekly.yaml b/trigger-erp-test-automation-weekly.yaml new file mode 100644 index 0000000000..c070113767 --- /dev/null +++ b/trigger-erp-test-automation-weekly.yaml @@ -0,0 +1,28 @@ +- job: + name: trigger-erp-test-automation-weekly + display-name: 'Trigger ERP test automation weekly' + project-type: freestyle + defaults: global + properties: + - authorization: + linaro: + - job-read + - job-extended-read + - job-build + - job-cancel + - build-discarder: + days-to-keep: 30 + num-to-keep: 30 + disabled: false + node: master + triggers: + - timed: '@weekly' + wrappers: + - timestamps + builders: + - trigger-builds: + - project: erp-test-automation + predefined-parameters: | + HOSTS=cb-g0 + BUILD_ENV=staging + BUILD_NUM=latest |