1*ff41da50SThomas Huth.. _ci_var:
2*ff41da50SThomas Huth
3*ff41da50SThomas HuthCustom CI/CD variables
4*ff41da50SThomas Huth======================
5*ff41da50SThomas Huth
6*ff41da50SThomas HuthQEMU CI pipelines can be tuned by setting some CI environment variables.
7*ff41da50SThomas Huth
8*ff41da50SThomas HuthSet variable globally in the user's CI namespace
9*ff41da50SThomas Huth------------------------------------------------
10*ff41da50SThomas Huth
11*ff41da50SThomas HuthVariables can be set globally in the user's CI namespace setting.
12*ff41da50SThomas Huth
13*ff41da50SThomas HuthFor further information about how to set these variables, please refer to::
14*ff41da50SThomas Huth
15*ff41da50SThomas Huth  https://docs.gitlab.com/ee/ci/variables/#add-a-cicd-variable-to-a-project
16*ff41da50SThomas Huth
17*ff41da50SThomas HuthSet variable manually when pushing a branch or tag to the user's repository
18*ff41da50SThomas Huth---------------------------------------------------------------------------
19*ff41da50SThomas Huth
20*ff41da50SThomas HuthVariables can be set manually when pushing a branch or tag, using
21*ff41da50SThomas Huthgit-push command line arguments.
22*ff41da50SThomas Huth
23*ff41da50SThomas HuthExample setting the QEMU_CI_EXAMPLE_VAR variable:
24*ff41da50SThomas Huth
25*ff41da50SThomas Huth.. code::
26*ff41da50SThomas Huth
27*ff41da50SThomas Huth   git push -o ci.variable="QEMU_CI_EXAMPLE_VAR=value" myrepo mybranch
28*ff41da50SThomas Huth
29*ff41da50SThomas HuthFor further information about how to set these variables, please refer to::
30*ff41da50SThomas Huth
31*ff41da50SThomas Huth  https://docs.gitlab.com/ee/user/project/push_options.html#push-options-for-gitlab-cicd
32*ff41da50SThomas Huth
33*ff41da50SThomas HuthSetting aliases in your git config
34*ff41da50SThomas Huth----------------------------------
35*ff41da50SThomas Huth
36*ff41da50SThomas HuthYou can use aliases to make it easier to push branches with different
37*ff41da50SThomas HuthCI configurations. For example define an alias for triggering CI:
38*ff41da50SThomas Huth
39*ff41da50SThomas Huth.. code::
40*ff41da50SThomas Huth
41*ff41da50SThomas Huth   git config --local alias.push-ci "push -o ci.variable=QEMU_CI=1"
42*ff41da50SThomas Huth   git config --local alias.push-ci-now "push -o ci.variable=QEMU_CI=2"
43*ff41da50SThomas Huth
44*ff41da50SThomas HuthWhich lets you run:
45*ff41da50SThomas Huth
46*ff41da50SThomas Huth.. code::
47*ff41da50SThomas Huth
48*ff41da50SThomas Huth   git push-ci
49*ff41da50SThomas Huth
50*ff41da50SThomas Huthto create the pipeline, or:
51*ff41da50SThomas Huth
52*ff41da50SThomas Huth.. code::
53*ff41da50SThomas Huth
54*ff41da50SThomas Huth   git push-ci-now
55*ff41da50SThomas Huth
56*ff41da50SThomas Huthto create and run the pipeline
57*ff41da50SThomas Huth
58*ff41da50SThomas Huth
59*ff41da50SThomas HuthVariable naming and grouping
60*ff41da50SThomas Huth----------------------------
61*ff41da50SThomas Huth
62*ff41da50SThomas HuthThe variables used by QEMU's CI configuration are grouped together
63*ff41da50SThomas Huthin a handful of namespaces
64*ff41da50SThomas Huth
65*ff41da50SThomas Huth * QEMU_JOB_nnnn - variables to be defined in individual jobs
66*ff41da50SThomas Huth   or templates, to influence the shared rules defined in the
67*ff41da50SThomas Huth   .base_job_template.
68*ff41da50SThomas Huth
69*ff41da50SThomas Huth * QEMU_CI_nnn - variables to be set by contributors in their
70*ff41da50SThomas Huth   repository CI settings, or as git push variables, to influence
71*ff41da50SThomas Huth   which jobs get run in a pipeline
72*ff41da50SThomas Huth
73*ff41da50SThomas Huth * QEMU_CI_CONTAINER_TAG - the tag used to publish containers
74*ff41da50SThomas Huth   in stage 1, for use by build jobs in stage 2. Defaults to
75*ff41da50SThomas Huth   'latest', but if running pipelines for different branches
76*ff41da50SThomas Huth   concurrently, it should be overridden per pipeline.
77*ff41da50SThomas Huth
78*ff41da50SThomas Huth * QEMU_CI_UPSTREAM - gitlab namespace that is considered to be
79*ff41da50SThomas Huth   the 'upstream'. This defaults to 'qemu-project'. Contributors
80*ff41da50SThomas Huth   may choose to override this if they are modifying rules in
81*ff41da50SThomas Huth   base.yml and need to validate how they will operate when in
82*ff41da50SThomas Huth   an upstream context, as opposed to their fork context.
83*ff41da50SThomas Huth
84*ff41da50SThomas Huth * nnn - other misc variables not falling into the above
85*ff41da50SThomas Huth   categories, or using different names for historical reasons
86*ff41da50SThomas Huth   and not yet converted.
87*ff41da50SThomas Huth
88*ff41da50SThomas HuthMaintainer controlled job variables
89*ff41da50SThomas Huth-----------------------------------
90*ff41da50SThomas Huth
91*ff41da50SThomas HuthThe following variables may be set when defining a job in the
92*ff41da50SThomas HuthCI configuration file.
93*ff41da50SThomas Huth
94*ff41da50SThomas HuthQEMU_JOB_CIRRUS
95*ff41da50SThomas Huth~~~~~~~~~~~~~~~
96*ff41da50SThomas Huth
97*ff41da50SThomas HuthThe job makes use of Cirrus CI infrastructure, requiring the
98*ff41da50SThomas Huthconfiguration setup for cirrus-run to be present in the repository
99*ff41da50SThomas Huth
100*ff41da50SThomas HuthQEMU_JOB_OPTIONAL
101*ff41da50SThomas Huth~~~~~~~~~~~~~~~~~
102*ff41da50SThomas Huth
103*ff41da50SThomas HuthThe job is expected to be successful in general, but is not run
104*ff41da50SThomas Huthby default due to need to conserve limited CI resources. It is
105*ff41da50SThomas Huthavailable to be started manually by the contributor in the CI
106*ff41da50SThomas Huthpipelines UI.
107*ff41da50SThomas Huth
108*ff41da50SThomas HuthQEMU_JOB_ONLY_FORKS
109*ff41da50SThomas Huth~~~~~~~~~~~~~~~~~~~
110*ff41da50SThomas Huth
111*ff41da50SThomas HuthThe job results are only of interest to contributors prior to
112*ff41da50SThomas Huthsubmitting code. They are not required as part of the gating
113*ff41da50SThomas HuthCI pipeline.
114*ff41da50SThomas Huth
115*ff41da50SThomas HuthQEMU_JOB_SKIPPED
116*ff41da50SThomas Huth~~~~~~~~~~~~~~~~
117*ff41da50SThomas Huth
118*ff41da50SThomas HuthThe job is not reliably successful in general, so is not
119*ff41da50SThomas Huthcurrently suitable to be run by default. Ideally this should
120*ff41da50SThomas Huthbe a temporary marker until the problems can be addressed, or
121*ff41da50SThomas Huththe job permanently removed.
122*ff41da50SThomas Huth
123*ff41da50SThomas HuthQEMU_JOB_PUBLISH
124*ff41da50SThomas Huth~~~~~~~~~~~~~~~~
125*ff41da50SThomas Huth
126*ff41da50SThomas HuthThe job is for publishing content after a branch has been
127*ff41da50SThomas Huthmerged into the upstream default branch.
128*ff41da50SThomas Huth
129*ff41da50SThomas HuthQEMU_JOB_AVOCADO
130*ff41da50SThomas Huth~~~~~~~~~~~~~~~~
131*ff41da50SThomas Huth
132*ff41da50SThomas HuthThe job runs the Avocado integration test suite
133*ff41da50SThomas Huth
134*ff41da50SThomas HuthContributor controlled runtime variables
135*ff41da50SThomas Huth----------------------------------------
136*ff41da50SThomas Huth
137*ff41da50SThomas HuthThe following variables may be set by contributors to control
138*ff41da50SThomas Huthjob execution
139*ff41da50SThomas Huth
140*ff41da50SThomas HuthQEMU_CI
141*ff41da50SThomas Huth~~~~~~~
142*ff41da50SThomas Huth
143*ff41da50SThomas HuthBy default, no pipelines will be created on contributor forks
144*ff41da50SThomas Huthin order to preserve CI credits
145*ff41da50SThomas Huth
146*ff41da50SThomas HuthSet this variable to 1 to create the pipelines, but leave all
147*ff41da50SThomas Huththe jobs to be manually started from the UI
148*ff41da50SThomas Huth
149*ff41da50SThomas HuthSet this variable to 2 to create the pipelines and run all
150*ff41da50SThomas Huththe jobs immediately, as was the historical behaviour
151*ff41da50SThomas Huth
152*ff41da50SThomas HuthQEMU_CI_AVOCADO_TESTING
153*ff41da50SThomas Huth~~~~~~~~~~~~~~~~~~~~~~~
154*ff41da50SThomas HuthBy default, tests using the Avocado framework are not run automatically in
155*ff41da50SThomas Huththe pipelines (because multiple artifacts have to be downloaded, and if
156*ff41da50SThomas Huththese artifacts are not already cached, downloading them make the jobs
157*ff41da50SThomas Huthreach the timeout limit). Set this variable to have the tests using the
158*ff41da50SThomas HuthAvocado framework run automatically.
159*ff41da50SThomas Huth
160*ff41da50SThomas HuthOther misc variables
161*ff41da50SThomas Huth--------------------
162*ff41da50SThomas Huth
163*ff41da50SThomas HuthThese variables are primarily to control execution of jobs on
164*ff41da50SThomas Huthprivate runners
165*ff41da50SThomas Huth
166*ff41da50SThomas HuthAARCH64_RUNNER_AVAILABLE
167*ff41da50SThomas Huth~~~~~~~~~~~~~~~~~~~~~~~~
168*ff41da50SThomas HuthIf you've got access to an aarch64 host that can be used as a gitlab-CI
169*ff41da50SThomas Huthrunner, you can set this variable to enable the tests that require this
170*ff41da50SThomas Huthkind of host. The runner should be tagged with "aarch64".
171*ff41da50SThomas Huth
172*ff41da50SThomas HuthAARCH32_RUNNER_AVAILABLE
173*ff41da50SThomas Huth~~~~~~~~~~~~~~~~~~~~~~~~
174*ff41da50SThomas HuthIf you've got access to an armhf host or an arch64 host that can run
175*ff41da50SThomas Huthaarch32 EL0 code to be used as a gitlab-CI runner, you can set this
176*ff41da50SThomas Huthvariable to enable the tests that require this kind of host. The
177*ff41da50SThomas Huthrunner should be tagged with "aarch32".
178*ff41da50SThomas Huth
179*ff41da50SThomas HuthS390X_RUNNER_AVAILABLE
180*ff41da50SThomas Huth~~~~~~~~~~~~~~~~~~~~~~
181*ff41da50SThomas HuthIf you've got access to an IBM Z host that can be used as a gitlab-CI
182*ff41da50SThomas Huthrunner, you can set this variable to enable the tests that require this
183*ff41da50SThomas Huthkind of host. The runner should be tagged with "s390x".
184*ff41da50SThomas Huth
185*ff41da50SThomas HuthCCACHE_DISABLE
186*ff41da50SThomas Huth~~~~~~~~~~~~~~
187*ff41da50SThomas HuthThe jobs are configured to use "ccache" by default since this typically
188*ff41da50SThomas Huthreduces compilation time, at the cost of increased storage. If the
189*ff41da50SThomas Huthuse of "ccache" is suspected to be hurting the overall job execution
190*ff41da50SThomas Huthtime, setting the "CCACHE_DISABLE=1" env variable to disable it.
191