Browse code

Document v2 to v3 devstack job migration

Document how to map DEVSTACK_GATE flags into the zuul v3 ansible
world. This is just an initial structure, the idea is to document
most of the flags as well as provide example in-line and links to
finished jobs.

Change-Id: I377ebb529bcd8f4971906563c577e8cfc48b98e6

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