Andrea Frittoli | f32f3f5 | 2018-02-19 21:45:22 +0000 | [diff] [blame] | 1 | =============================== |
| 2 | Migrating Zuul V2 CI jobs to V3 |
| 3 | =============================== |
| 4 | |
| 5 | The OpenStack CI system moved from Zuul v2 to Zuul v3, and all CI jobs moved to |
| 6 | the new CI system. All jobs have been migrated automatically to a format |
| 7 | compatible with Zuul v3; the jobs produced in this way however are suboptimal |
| 8 | and do not use the capabilities introduced by Zuul v3, which allow for re-use of |
| 9 | job parts, in the form of Ansible roles, as well as inheritance between jobs. |
| 10 | |
| 11 | DevStack hosts a set of roles, plays and jobs that can be used by other |
| 12 | repositories to define their DevStack based jobs. To benefit from them, jobs |
| 13 | must be migrated from the legacy v2 ones into v3 native format. |
| 14 | |
| 15 | This document provides guidance and examples to make the migration process as |
| 16 | painless and smooth as possible. |
| 17 | |
| 18 | Where to host the job definitions. |
| 19 | ================================== |
| 20 | |
| 21 | In Zuul V3 jobs can be defined in the repository that contains the code they |
| 22 | excercise. If you are writing CI jobs for an OpenStack service you can define |
| 23 | your DevStack based CI jobs in one of the repositories that host the code for |
| 24 | your service. If you have a branchless repo, like a Tempest plugin, that is |
| 25 | a convenient choice to host the job definitions since job changes do not have |
| 26 | to be backported. For example, see the beginning of the ``.zuul.yaml`` from the |
| 27 | sahara Tempest plugin repo: |
| 28 | |
| 29 | .. code:: yaml |
| 30 | |
Matt Riedemann | 9b6d2f2 | 2019-06-18 10:43:16 -0400 | [diff] [blame] | 31 | # In https://opendev.org/openstack/sahara-tests/src/branch/master/.zuul.yaml: |
Andrea Frittoli | f32f3f5 | 2018-02-19 21:45:22 +0000 | [diff] [blame] | 32 | - job: |
| 33 | name: sahara-tests-tempest |
| 34 | description: | |
| 35 | Run Tempest tests from the Sahara plugin. |
| 36 | parent: devstack-tempest |
| 37 | |
| 38 | Which base job to start from |
| 39 | ============================ |
| 40 | |
| 41 | If your job needs an OpenStack cloud deployed via DevStack, but you don't plan |
| 42 | on running Tempest tests, you can start from one of the base |
| 43 | :doc:`jobs <zuul_jobs>` defined in the DevStack repo. |
| 44 | |
| 45 | The ``devstack`` job can be used for both single-node jobs and multi-node jobs, |
| 46 | and it includes the list of services used in the integrated gate (keystone, |
| 47 | glance, nova, cinder, neutron and swift). Different topologies can be achieved |
| 48 | by switching the nodeset used in the child job. |
| 49 | |
| 50 | The ``devstack-base`` job is similar to ``devstack`` but it does not specify any |
| 51 | required repo or service to be run in DevStack. It can be useful to setup |
| 52 | children jobs that use a very narrow DevStack setup. |
| 53 | |
| 54 | If your job needs an OpenStack cloud deployed via DevStack, and you do plan |
| 55 | on running Tempest tests, you can start from one of the base jobs defined in the |
| 56 | Tempest repo. |
| 57 | |
| 58 | The ``devstack-tempest`` job can be used for both single-node jobs and |
| 59 | multi-node jobs. Different topologies can be achieved by switching the nodeset |
| 60 | used in the child job. |
| 61 | |
| 62 | Jobs can be customized as follows without writing any Ansible code: |
| 63 | |
| 64 | - add and/or remove DevStack services |
| 65 | - add or modify DevStack and services configuration |
| 66 | - install DevStack plugins |
| 67 | - extend the number of sub-nodes (multinode only) |
| 68 | - define extra log files and/or directories to be uploaded on logs.o.o |
| 69 | - define extra log file extensions to be rewritten to .txt for ease of access |
| 70 | |
| 71 | Tempest jobs can be further customized as follows: |
| 72 | |
| 73 | - define the Tempest tox environment to be used |
| 74 | - define the test concurrency |
| 75 | - define the test regular expression |
| 76 | |
| 77 | Writing Ansible code, or importing existing custom roles, jobs can be further |
| 78 | extended by: |
| 79 | |
| 80 | - adding pre and/or post playbooks |
| 81 | - overriding the run playbook, add custom roles |
| 82 | |
| 83 | The (partial) example below extends a Tempest single node base job |
| 84 | "devstack-tempest" in the Kuryr repository. The parent job name is defined in |
| 85 | job.parent. |
| 86 | |
| 87 | .. code:: yaml |
| 88 | |
Matt Riedemann | 9b6d2f2 | 2019-06-18 10:43:16 -0400 | [diff] [blame] | 89 | # https://opendev.org/openstack/kuryr-kubernetes/src/branch/master/.zuul.d/base.yaml: |
Andrea Frittoli | f32f3f5 | 2018-02-19 21:45:22 +0000 | [diff] [blame] | 90 | - job: |
| 91 | name: kuryr-kubernetes-tempest-base |
| 92 | parent: devstack-tempest |
| 93 | description: Base kuryr-kubernetes-job |
| 94 | required-projects: |
| 95 | - openstack/devstack-plugin-container |
| 96 | - openstack/kuryr |
| 97 | - openstack/kuryr-kubernetes |
| 98 | - openstack/kuryr-tempest-plugin |
| 99 | - openstack/neutron-lbaas |
| 100 | vars: |
| 101 | tempest_test_regex: '^(kuryr_tempest_plugin.tests.)' |
| 102 | tox_envlist: 'all' |
| 103 | devstack_localrc: |
| 104 | KURYR_K8S_API_PORT: 8080 |
Andrea Frittoli | f32f3f5 | 2018-02-19 21:45:22 +0000 | [diff] [blame] | 105 | devstack_services: |
| 106 | kubernetes-api: true |
| 107 | kubernetes-controller-manager: true |
| 108 | kubernetes-scheduler: true |
| 109 | kubelet: true |
| 110 | kuryr-kubernetes: true |
| 111 | (...) |
| 112 | devstack_plugins: |
Matt Riedemann | 9b6d2f2 | 2019-06-18 10:43:16 -0400 | [diff] [blame] | 113 | kuryr-kubernetes: https://opendev.org/openstack/kuryr |
| 114 | devstack-plugin-container: https://opendev.org/openstack/devstack-plugin-container |
| 115 | neutron-lbaas: https://opendev.org/openstack/neutron-lbaas |
Luigi Toscano | 70d043d | 2019-03-12 22:25:44 +0100 | [diff] [blame] | 116 | tempest_plugins: |
| 117 | - kuryr-tempest-plugin |
Andrea Frittoli | f32f3f5 | 2018-02-19 21:45:22 +0000 | [diff] [blame] | 118 | (...) |
| 119 | |
| 120 | Job variables |
| 121 | ============= |
| 122 | |
| 123 | Variables can be added to the job in three different places: |
| 124 | |
| 125 | - job.vars: these are global variables available to all node in the nodeset |
| 126 | - job.host-vars.[HOST]: these are variables available only to the specified HOST |
| 127 | - job.group-vars.[GROUP]: these are variables available only to the specified |
| 128 | GROUP |
| 129 | |
| 130 | Zuul merges dict variables through job inheritance. Host and group variables |
| 131 | override variables with the same name defined as global variables. |
| 132 | |
| 133 | In the example below, for the sundaes job, hosts that are not part of the |
| 134 | subnode group will run vanilla and chocolate. Hosts in the subnode group will |
| 135 | run stracciatella and strawberry. |
| 136 | |
| 137 | .. code:: yaml |
| 138 | |
| 139 | - job: |
| 140 | name: ice-creams |
| 141 | vars: |
| 142 | devstack_service: |
| 143 | vanilla: true |
| 144 | chocolate: false |
| 145 | group-vars: |
| 146 | subnode: |
| 147 | devstack_service: |
| 148 | pistacchio: true |
| 149 | stracciatella: true |
| 150 | |
| 151 | - job: |
| 152 | name: sundaes |
| 153 | parent: ice-creams |
| 154 | vars: |
| 155 | devstack_service: |
| 156 | chocolate: true |
| 157 | group-vars: |
| 158 | subnode: |
| 159 | devstack_service: |
| 160 | strawberry: true |
| 161 | pistacchio: false |
| 162 | |
| 163 | |
| 164 | DevStack Gate Flags |
| 165 | =================== |
| 166 | |
| 167 | The old CI system worked using a combination of DevStack, Tempest and |
| 168 | devstack-gate to setup a test environment and run tests against it. With Zuul |
| 169 | V3, the logic that used to live in devstack-gate is moved into different repos, |
| 170 | including DevStack, Tempest and grenade. |
| 171 | |
| 172 | DevStack-gate exposes an interface for job definition based on a number of |
| 173 | DEVSTACK_GATE_* environment variables, or flags. This guide shows how to map |
| 174 | DEVSTACK_GATE flags into the new |
| 175 | system. |
| 176 | |
| 177 | The repo column indicates in which repository is hosted the code that replaces |
| 178 | the devstack-gate flag. The new implementation column explains how to reproduce |
| 179 | the same or a similar behaviour in Zuul v3 jobs. For localrc settings, |
| 180 | devstack-gate defined a default value. In ansible jobs the default is either the |
| 181 | value defined in the parent job, or the default from DevStack, if any. |
| 182 | |
Andreas Jaeger | d3a2fcf | 2019-08-13 19:27:06 +0200 | [diff] [blame] | 183 | .. list-table:: **DevStack Gate Flags** |
| 184 | :widths: 20 10 60 |
| 185 | :header-rows: 1 |
| 186 | |
| 187 | * - DevStack gate flag |
| 188 | - Repo |
| 189 | - New implementation |
| 190 | * - OVERRIDE_ZUUL_BRANCH |
| 191 | - zuul |
| 192 | - override-checkout: [branch] in the job definition. |
| 193 | * - DEVSTACK_GATE_NET_OVERLAY |
| 194 | - zuul-jobs |
| 195 | - A bridge called br-infra is set up for all jobs that inherit |
| 196 | from multinode with a dedicated `bridge role |
| 197 | <https://zuul-ci.org/docs/zuul-jobs/general-roles.html#role-multi-node-bridge>`_. |
Andreas Jaeger | d3a2fcf | 2019-08-13 19:27:06 +0200 | [diff] [blame] | 198 | * - DEVSTACK_CINDER_VOLUME_CLEAR |
| 199 | - devstack |
| 200 | - *CINDER_VOLUME_CLEAR: true/false* in devstack_localrc in the |
| 201 | job vars. |
| 202 | * - DEVSTACK_GATE_NEUTRON |
| 203 | - devstack |
| 204 | - True by default. To disable, disable all neutron services in |
| 205 | devstack_services in the job definition. |
| 206 | * - DEVSTACK_GATE_CONFIGDRIVE |
| 207 | - devstack |
| 208 | - *FORCE_CONFIG_DRIVE: true/false* in devstack_localrc in the job |
| 209 | vars. |
| 210 | * - DEVSTACK_GATE_INSTALL_TESTONLY |
| 211 | - devstack |
| 212 | - *INSTALL_TESTONLY_PACKAGES: true/false* in devstack_localrc in |
| 213 | the job vars. |
| 214 | * - DEVSTACK_GATE_VIRT_DRIVER |
| 215 | - devstack |
| 216 | - *VIRT_DRIVER: [virt driver]* in devstack_localrc in the job |
| 217 | vars. |
| 218 | * - DEVSTACK_GATE_LIBVIRT_TYPE |
| 219 | - devstack |
| 220 | - *LIBVIRT_TYPE: [libvirt type]* in devstack_localrc in the job |
| 221 | vars. |
| 222 | * - DEVSTACK_GATE_TEMPEST |
| 223 | - devstack and tempest |
| 224 | - Defined by the job that is used. The ``devstack`` job only runs |
| 225 | devstack. The ``devstack-tempest`` one triggers a Tempest run |
| 226 | as well. |
| 227 | * - DEVSTACK_GATE_TEMPEST_FULL |
| 228 | - tempest |
| 229 | - *tox_envlist: full* in the job vars. |
| 230 | * - DEVSTACK_GATE_TEMPEST_ALL |
| 231 | - tempest |
| 232 | - *tox_envlist: all* in the job vars. |
| 233 | * - DEVSTACK_GATE_TEMPEST_ALL_PLUGINS |
| 234 | - tempest |
| 235 | - *tox_envlist: all-plugin* in the job vars. |
| 236 | * - DEVSTACK_GATE_TEMPEST_SCENARIOS |
| 237 | - tempest |
| 238 | - *tox_envlist: scenario* in the job vars. |
| 239 | * - TEMPEST_CONCURRENCY |
| 240 | - tempest |
| 241 | - *tempest_concurrency: [value]* in the job vars. This is |
| 242 | available only on jobs that inherit from ``devstack-tempest`` |
| 243 | down. |
| 244 | * - DEVSTACK_GATE_TEMPEST_NOTESTS |
| 245 | - tempest |
| 246 | - *tox_envlist: venv-tempest* in the job vars. This will create |
| 247 | Tempest virtual environment but run no tests. |
| 248 | * - DEVSTACK_GATE_SMOKE_SERIAL |
| 249 | - tempest |
| 250 | - *tox_envlist: smoke-serial* in the job vars. |
| 251 | * - DEVSTACK_GATE_TEMPEST_DISABLE_TENANT_ISOLATION |
| 252 | - tempest |
| 253 | - *tox_envlist: full-serial* in the job vars. |
| 254 | *TEMPEST_ALLOW_TENANT_ISOLATION: false* in devstack_localrc in |
| 255 | the job vars. |
| 256 | |
Andrea Frittoli | f32f3f5 | 2018-02-19 21:45:22 +0000 | [diff] [blame] | 257 | |
| 258 | The following flags have not been migrated yet or are legacy and won't be |
| 259 | migrated at all. |
| 260 | |
Andreas Jaeger | d3a2fcf | 2019-08-13 19:27:06 +0200 | [diff] [blame] | 261 | .. list-table:: **Not Migrated DevStack Gate Flags** |
| 262 | :widths: 20 10 60 |
| 263 | :header-rows: 1 |
| 264 | |
| 265 | * - DevStack gate flag |
| 266 | - Status |
| 267 | - Details |
| 268 | * - DEVSTACK_GATE_TOPOLOGY |
| 269 | - WIP |
| 270 | - The topology depends on the base job that is used and more |
| 271 | specifically on the nodeset attached to it. The new job format |
| 272 | allows project to define the variables to be passed to every |
| 273 | node/node-group that exists in the topology. Named topologies |
| 274 | that include the nodeset and the matching variables can be |
| 275 | defined in the form of base jobs. |
| 276 | * - DEVSTACK_GATE_GRENADE |
| 277 | - TBD |
| 278 | - Grenade Zuul V3 jobs will be hosted in the grenade repo. |
| 279 | * - GRENADE_BASE_BRANCH |
| 280 | - TBD |
| 281 | - Grenade Zuul V3 jobs will be hosted in the grenade repo. |
| 282 | * - DEVSTACK_GATE_NEUTRON_DVR |
| 283 | - TBD |
| 284 | - Depends on multinode support. |
| 285 | * - DEVSTACK_GATE_EXERCISES |
| 286 | - TBD |
| 287 | - Can be done on request. |
| 288 | * - DEVSTACK_GATE_IRONIC |
| 289 | - TBD |
| 290 | - This will probably be implemented on ironic side. |
| 291 | * - DEVSTACK_GATE_IRONIC_DRIVER |
| 292 | - TBD |
| 293 | - This will probably be implemented on ironic side. |
| 294 | * - DEVSTACK_GATE_IRONIC_BUILD_RAMDISK |
| 295 | - TBD |
| 296 | - This will probably be implemented on ironic side. |
| 297 | * - DEVSTACK_GATE_POSTGRES |
| 298 | - Legacy |
Matt Riedemann | b14665f | 2019-10-17 19:34:05 +0000 | [diff] [blame] | 299 | - This flag exists in d-g but the only thing that it does is |
| 300 | capture postgres logs. This is already supported by the roles |
| 301 | in post, so the flag is useless in the new jobs. postgres |
| 302 | itself can be enabled via the devstack_service job variable. |
Andreas Jaeger | d3a2fcf | 2019-08-13 19:27:06 +0200 | [diff] [blame] | 303 | * - DEVSTACK_GATE_ZEROMQ |
| 304 | - Legacy |
| 305 | - This has no effect in d-g. |
| 306 | * - DEVSTACK_GATE_MQ_DRIVER |
| 307 | - Legacy |
| 308 | - This has no effect in d-g. |
| 309 | * - DEVSTACK_GATE_TEMPEST_STRESS_ARGS |
| 310 | - Legacy |
| 311 | - Stress is not in Tempest anymore. |
| 312 | * - DEVSTACK_GATE_TEMPEST_HEAT_SLOW |
| 313 | - Legacy |
| 314 | - This is not used anywhere. |
| 315 | * - DEVSTACK_GATE_CELLS |
| 316 | - Legacy |
| 317 | - This has no effect in d-g. |
| 318 | * - DEVSTACK_GATE_NOVA_API_METADATA_SPLIT |
| 319 | - Legacy |
| 320 | - This has no effect in d-g. |