summaryrefslogtreecommitdiff
path: root/playbooks/tripleo-ci/run-v3.yaml
blob: 8fe3f53fb8d8f44b37cd872b14fbea33ac859967 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
- hosts: all
  name: Common tasks for nodes preparation
  tasks:

    - name: Include common vars
      include_vars:
        file: "common.yaml"

    - name: Swap is essential as we are not meeting memory requirements
      include_role:
        name: configure-swap

    - name: Set legacy log path
      include_role:
        name: set-zuul-log-path-fact

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

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

    - name: Hard link tripleo-ci to openstack namespace dir
      shell:
        cmd: |
          set -e
          set -x
          # we still need all the repos under the same root directory, but instead of using
          # zuul-cloner, use the wrapped commands directly
          cp -dRl /home/zuul/src/git.openstack.org/openstack-infra/tripleo-ci .
        executable: /bin/bash
        chdir: '{{ tripleo_root }}'
      environment: '{{ zuul | zuul_legacy_vars }}'


    - set_fact:
        zuul_dump: "{{ {'zuul': zuul} }}"

    - name: Dump zuul variables on the host to pass it to inner ansible
      copy:
        content: "{{ zuul_dump|to_nice_yaml }}"
        dest: "{{ workspace }}/logs//zuul-variables.yaml"

- hosts:
    - primary
    - centos-7
  name: tripleo CI jobs runner
  tasks:
    - block:
      - name: Check overridable settings
        vars:
          allowed_overrides:
            - 'run_tempest'
            - 'tempest_whitelist'
            - 'test_black_regex'
            - 'tempest_format'
            - 'tempest_extra_config'
            - 'tempest_plugins'
            - 'standalone_environment_files'
        fail:
          msg: "ERROR: {{ item }} is not overridable."
        when: item not in "{{ allowed_overrides }}"
        with_items: "{{ featureset_override }}"
      - name: Generate standalone_custom_env_files from standalone_environment_files
        set_fact:
          featureset_override: "{{ featureset_override | combine(custom_env, recursive=true) }}"
        vars:
          custom_env: { 'standalone_custom_env_files': "{{ featureset_override.standalone_environment_files | default([]) | map('regex_replace', '(.*)', '/usr/share/openstack-tripleo-heat-templates/\\1') | list }}" }
        when: featureset_override['standalone_environment_files'] is defined
      - name: Generate featureset overriding file
        template:
          src: templates/featureset-override.j2
          dest: "{{ tripleo_root }}/tripleo-ci/featureset-override.yaml"
          mode: 0755
          force: yes
      - name: Include some extra for generating toci scripts
        set_fact:
          extra_vars: "--extra-vars @{{ tripleo_root }}/tripleo-ci/featureset-override.yaml"
      when: featureset_override is defined

    - name: render toci_gate_test script
      template:
        src: templates/toci_gate_test.sh.j2
        dest: "{{ tripleo_root }}/tripleo-ci/toci_gate_test.sh"
        mode: 0755
        force: yes

    - name: render toci_quickstart script
      template:
        src: templates/toci_quickstart.sh.j2
        dest: "{{ tripleo_root }}/tripleo-ci/toci_quickstart.sh"
        mode: 0755
        force: yes

    - name: render common_vars script
      template:
        src: templates/common_vars.bash.j2
        dest: "{{ tripleo_root }}/tripleo-ci/scripts/common_vars.bash"
        force: yes

    - name: render oooq_common_functions script
      template:
        src: templates/oooq_common_functions.sh.j2
        dest: "{{ tripleo_root }}/tripleo-ci/scripts/oooq_common_functions.sh"
        force: yes

    - shell:
        cmd: |
          set -e
          set -x
          {% if nodes is defined %}
          export TOCI_JOBTYPE={{ environment_type }}-{{ nodes }}-featureset{{ featureset }}
          {% else %}
          export TOCI_JOBTYPE={{ environment_type }}-featureset{{ featureset }}
          {% endif %}
          export DISTRIBUTION={{ ansible_distribution }}
          export DISTRIBUTION_MAJOR_VERSION={{ ansible_distribution_major_version }}

          {% if nodes is defined %}
          export NODES_FILE={{ nodes_file }}
          {% endif %}

          # ZUUL does not set these for periodic jobs
          export ZUUL_BRANCH=${ZUUL_BRANCH:-master}
          export ZUUL_REF=${ZUUL_REF:-None}

          # Compatibility with zuul v3 variables
          export JOB_NAME={{ zuul.job }}
          export LOG_PATH={{ zuul_log_path }}

          export BRANCH_OVERRIDE="{{ branch_override | default('default') }}"
          if [ "$BRANCH_OVERRIDE" != "default" ] ; then
              export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE
          fi

          export PYTHONUNBUFFERED=true
          export TRIPLEO_ROOT={{ tripleo_root }}
          # NOTE(trown) We can move this into the multinode environment file once we
          # migrate the 2-node jobs over to zuulv3
          bash -xe $TRIPLEO_ROOT/tripleo-ci/toci_gate_test.sh
        executable: /bin/bash
        chdir: '{{ tripleo_root }}'
      environment: '{{ zuul | zuul_legacy_vars }}'