aboutsummaryrefslogtreecommitdiff
path: root/erp-playbook/main.yml
blob: 1a1f0934d13eb79b65968ded38eab9d8edf49bfe (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
---
- hosts: erp
  become: yes
  become_method: su
  vars:
    squad_environment: production

  tasks:
  - name: Verify build_number is set
    assert:
      that:
        - "build_number > 0"

  - name: Check for /root/test-definitions
    stat:
      path: /root/test-definitions
    register: tests_run
  - name: Verify host is clean
    fail:
      msg: Error - It looks like tests have already run on this host.
    when: tests_run.stat.exists

  - name: Package Prerequisites
    apt:
      update_cache: yes
      cache_valid_time: 86400
      pkg: "{{item}}"
    with_items:
      - git
      - python-pip
      - daemon
      - sysstat # for troubleshooting
      - strace # for troubleshooting

  - name: Clone test-definitions repository
    git:
      repo: 'https://git.linaro.org/qa/test-definitions.git'
      dest: /root/test-definitions
      version: erp-17.08

  - name: Install python prerequisites
    pip:
      requirements: /root/test-definitions/automated/utils/requirements.txt

  - name: Install python prerequisites
    pip:
      name: python-slugify

  - name: Copy test harness
    template:
      src: run_erp_suite.sh
      dest: /root/run_erp_suite.sh
      mode: 0755

  - name: Run ERP test suite
    # daemon --name ensures only one runs at a time
    command: daemon --name=erp_suite --errlog=/root/run_erp_suite.stderr.log --dbglog=/root/run_erp_suite.stdout.log -- /root/run_erp_suite.sh {{build_number}}
    environment:
      SQUAD_AUTH_TOKEN: "{{squad[squad_environment]['auth_token']}}"