aboutsummaryrefslogtreecommitdiff
path: root/erp-playbook/README.md
blob: e1a39b73717da66508fdbf06458eb209e9c67e7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# ERP Test Harness

This ansible playbook can be used to automate the ERP testing on a set of given
hosts.

## Roles

ERP testing is as easy as 1 2 3:
1. Get a build
2. Load a build on a host (provision)
3. Install prerequisites on a host and run the tests autonomously

The ansible run is idempotent; each time it is run, if the tests are already
running on a host it will not do anything. If the tests are not running on a
host, it will start them.

### Find ERP build

The `erp_get_build` role will ask jenkins for the latest build and then
download the build locally. This role is required to be run before the
subsequent roles.

### Provision Host

Depending on which lab a host is in (defined by their host group in `hosts`), a
lab-specific role will be run to provision a host.

The `erp_provision_austin_host` is used to provision hosts in the US Austin
lab.

The `erp_provision_cambridge_host` is used to provision hosts in the UK
Cambridge lab.

### Run ERP Test Suite

The `erp_run_test_suite` will ssh into the given host, install test-definitions
prerequisites, clone test-definitions, run each test plan that is used for ERP
testing, and post the results to https://qa-reports.linaro.org/ using the given
latest build number (discovered in `erp_get_build`).

## Usage

See the `Makefile` for example usecases.

Note that 'hosts' and 'group_vars/all' files are encrypted using ansible vault.
To use, the vault password will have to be available in ~/.vault_pass_erp.txt.
Once set, use `ansible-vault edit` to view and modify.

See `hosts.dist` and `group_vars/erp_all.dist` for examples of inventory
definitions.

To run against a given host or host group, run `ansible-playbook -l
<hostname|hostgroup> main.yml`. If -l (limit) is not used, ansible will attempt
to run against every host defined in `hosts`.

## Examples

Provision hosts in the 'erp-drue' hostgroup:

    make run-drue

Run tests against already-provisioned hosts in the 'erp-drue' hostgroup, but
set build number explicitly:

    make run-drue BUILD_NUM=450

Provision and run against hosts using the stable build number 321:

    make provision-drue BUILD_ENV=staging BUILD_NUM=321
    make run-drue BUILD_ENV=staging BUILD_NUM=321