xref: /openbmc/qemu/.gitlab-ci.d/cirrus/README.rst (revision 438951e8839c66a0d0f65011a7a4ff6bd50efad6)
1*0e103a65SDaniel P. BerrangéCirrus CI integration
2*0e103a65SDaniel P. Berrangé=====================
3*0e103a65SDaniel P. Berrangé
4*0e103a65SDaniel P. BerrangéGitLab CI shared runners only provide a docker environment running on Linux.
5*0e103a65SDaniel P. BerrangéWhile it is possible to provide private runners for non-Linux platforms this
6*0e103a65SDaniel P. Berrangéis not something most contributors/maintainers will wish to do.
7*0e103a65SDaniel P. Berrangé
8*0e103a65SDaniel P. BerrangéTo work around this limitation, we take advantage of `Cirrus CI`_'s free
9*0e103a65SDaniel P. Berrangéoffering: more specifically, we use the `cirrus-run`_ script to trigger Cirrus
10*0e103a65SDaniel P. BerrangéCI jobs from GitLab CI jobs so that Cirrus CI job output is integrated into
11*0e103a65SDaniel P. Berrangéthe main GitLab CI pipeline dashboard.
12*0e103a65SDaniel P. Berrangé
13*0e103a65SDaniel P. BerrangéThere is, however, some one-time setup required. If you want FreeBSD and macOS
14*0e103a65SDaniel P. Berrangébuilds to happen when you push to your GitLab repository, you need to
15*0e103a65SDaniel P. Berrangé
16*0e103a65SDaniel P. Berrangé* set up a GitHub repository for the project, eg. ``yourusername/qemu``.
17*0e103a65SDaniel P. Berrangé  This repository needs to exist for cirrus-run to work, but it doesn't need to
18*0e103a65SDaniel P. Berrangé  be kept up to date, so you can create it and then forget about it;
19*0e103a65SDaniel P. Berrangé
20*0e103a65SDaniel P. Berrangé* enable the `Cirrus CI GitHub app`_  for your GitHub account;
21*0e103a65SDaniel P. Berrangé
22*0e103a65SDaniel P. Berrangé* sign up for Cirrus CI. It's enough to log into the website using your GitHub
23*0e103a65SDaniel P. Berrangé  account;
24*0e103a65SDaniel P. Berrangé
25*0e103a65SDaniel P. Berrangé* grab an API token from the `Cirrus CI settings`_ page;
26*0e103a65SDaniel P. Berrangé
27*0e103a65SDaniel P. Berrangé* it may be necessary to push an empty ``.cirrus.yml`` file to your github fork
28*0e103a65SDaniel P. Berrangé  for Cirrus CI to properly recognize the project. You can check whether
29*0e103a65SDaniel P. Berrangé  Cirrus CI knows about your project by navigating to:
30*0e103a65SDaniel P. Berrangé
31*0e103a65SDaniel P. Berrangé  ``https://cirrus-ci.com/yourusername/qemu``
32*0e103a65SDaniel P. Berrangé
33*0e103a65SDaniel P. Berrangé* in the *CI/CD / Variables* section of the settings page for your GitLab
34*0e103a65SDaniel P. Berrangé  repository, create two new variables:
35*0e103a65SDaniel P. Berrangé
36*0e103a65SDaniel P. Berrangé  * ``CIRRUS_GITHUB_REPO``, containing the name of the GitHub repository
37*0e103a65SDaniel P. Berrangé    created earlier, eg. ``yourusername/qemu``;
38*0e103a65SDaniel P. Berrangé
39*0e103a65SDaniel P. Berrangé  * ``CIRRUS_API_TOKEN``, containing the Cirrus CI API token generated earlier.
40*0e103a65SDaniel P. Berrangé    This variable **must** be marked as *Masked*, because anyone with knowledge
41*0e103a65SDaniel P. Berrangé    of it can impersonate you as far as Cirrus CI is concerned.
42*0e103a65SDaniel P. Berrangé
43*0e103a65SDaniel P. Berrangé  Neither of these variables should be marked as *Protected*, because in
44*0e103a65SDaniel P. Berrangé  general you'll want to be able to trigger Cirrus CI builds from non-protected
45*0e103a65SDaniel P. Berrangé  branches.
46*0e103a65SDaniel P. Berrangé
47*0e103a65SDaniel P. BerrangéOnce this one-time setup is complete, you can just keep pushing to your GitLab
48*0e103a65SDaniel P. Berrangérepository as usual and you'll automatically get the additional CI coverage.
49*0e103a65SDaniel P. Berrangé
50*0e103a65SDaniel P. Berrangé
51*0e103a65SDaniel P. Berrangé.. _Cirrus CI GitHub app: https://github.com/marketplace/cirrus-ci
52*0e103a65SDaniel P. Berrangé.. _Cirrus CI settings: https://cirrus-ci.com/settings/profile/
53*0e103a65SDaniel P. Berrangé.. _Cirrus CI: https://cirrus-ci.com/
54*0e103a65SDaniel P. Berrangé.. _cirrus-run: https://github.com/sio/cirrus-run/
55