summaryrefslogtreecommitdiff
path: root/playbooks/legacy/oslo.db-tox-mysql-python/run.yaml
blob: 5bdd811f798ef9e31d1d6fa777bf2de3d4040da6 (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
- hosts: all
  name: Autoconverted job legacy-oslo.db-tox-mysql-python from old job gate-oslo.db-tox-mysql-python-ubuntu-xenial
  tasks:

    - name: Ensure legacy workspace directory
      file:
        path: '{{ ansible_user_dir }}/workspace'
        state: directory

    - shell:
        cmd: |
          set -e
          set -x
          CLONEMAP=`mktemp`
          REQS_DIR=`mktemp -d`
          function cleanup {
              mkdir -p $WORKSPACE
              rm -rf $CLONEMAP $REQS_DIR
          }
          trap cleanup EXIT
          cat > $CLONEMAP << EOF
          clonemap:
            - name: $ZUUL_PROJECT
              dest: .
          EOF
          # zuul cloner works poorly if there are 2 names that are the
          # same in here.
          if [[ "$ZUUL_PROJECT" != "openstack/requirements" ]]; then
          cat >> $CLONEMAP << EOF
            - name: openstack/requirements
              dest: $REQS_DIR
          EOF
          fi
          /usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
              git://git.openstack.org $ZUUL_PROJECT openstack/requirements
          # REQS_DIR is not set for openstack/requirements and there is also
          # no need to copy in this case.
          if [[ "$ZUUL_PROJECT" != "openstack/requirements" ]]; then
              cp $REQS_DIR/upper-constraints.txt ./
          fi
        executable: /bin/bash
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'

    - shell:
        cmd: /usr/local/jenkins/slave_scripts/install-distro-packages.sh
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'

    - shell:
        cmd: |
          if [ -x tools/test-setup.sh ] ; then
            tools/test-setup.sh
          fi
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'

    - shell:
        cmd: |
          set -x
          sudo rm -f /etc/sudoers.d/zuul
          # Prove that general sudo access is actually revoked
          ! sudo -n true
        executable: /bin/bash
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'

    - shell:
        cmd: /usr/local/jenkins/slave_scripts/run-tox.sh mysql-python
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'

    - shell:
        cmd: |
          OUT=`git ls-files --other --exclude-standard --directory`
          if [ -z "$OUT" ]; then
              echo "No extra files created during test."
              exit 0
          else
              echo "The following un-ignored files were created during the test:"
              echo "$OUT"
              exit 0  # TODO: change to 1 to fail tests.
          fi
        executable: /bin/bash
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'