1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-28 11:21:44 +03:00
libvirt/ci
Andrea Bolognani fb91290131 cirrus: Generate jobs dynamically
Instead of having static job definitions for FreeBSD and macOS,
use a generic template for both and fill in the details that are
actually different, such as the list of packages to install, in
the GitLab CI job, right before calling cirrus-run.

The target-specific information are provided by lcitool, so that
keeping them up to date is just a matter of running the refresh
script when necessary.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-07-03 11:00:22 +02:00
..
cirrus cirrus: Generate jobs dynamically 2020-07-03 11:00:22 +02:00
containers ci: Refresh Dockerfiles 2020-06-25 14:28:25 +02:00
build.sh gnulib: delete all gnulib integration 2020-02-07 15:03:54 +00:00
list-images.sh ci: Update build system integration 2020-06-11 19:06:53 +02:00
Makefile ci: Makefile: Mention CI_MAKE_ARGS and CI_CONFIGURE_ARGS in ci-help 2020-06-18 09:19:21 +02:00
prepare.sh ci: Run $(CI_PREPARE_SCRIPT) as root 2019-08-21 18:58:31 +02:00
README.rst ci: Enable Cirrus CI integration 2020-06-10 10:30:56 +02:00

==============
CI for libvirt
==============

This document provides some information related to the CI capabilities for the
libvirt project.


Cirrus CI integration
=====================

libvirt currently supports three non-Linux operating systems: Windows, FreeBSD
and macOS. Windows cross-builds can be prepared on Linux by using `MinGW`_, but
for both FreeBSD and macOS we need to use the actual operating system, and
unfortunately GitLab shared runners are currently not available for either.

To work around this limitation, we take advantage of `Cirrus CI`_'s free
offering: more specifically, we use the `cirrus-run`_ script to trigger Cirrus
CI jobs from GitLab CI jobs so that the workaround is almost entirely
transparent to users and there's no need to constantly check two separate CI
dashboards.

There is, however, some one-time setup required. If you want FreeBSD and macOS
builds to happen when you push to your GitLab repository, you need to

* set up a GitHub repository for the project, eg. ``yourusername/libvirt``.
  This repository needs to exist for cirrus-run to work, but it doesn't need to
  be kept up to date, so you can create it and then forget about it;

* enable the `Cirrus CI GitHub app`_  for your GitHub account;

* sign up for Cirrus CI. It's enough to log into the website using your GitHub
  account;

* grab an API token from the `Cirrus CI settings`_ page;

* in the *CI/CD / Variables* section of the settings page for your GitLab
  repository, create two new variables:

  * ``CIRRUS_GITHUB_REPO``, containing the name of the GitHub repository
    created earlier, eg. ``yourusername/libvirt``;

  * ``CIRRUS_API_TOKEN``, containing the Cirrus CI API token generated earlier.
    This variable **must** be marked as *Masked*, because anyone with knowledge
    of it can impersonate you as far as Cirrus CI is concerned.

  Neither of these variables should be marked as *Protected*, because in
  general you'll want to be able to trigger Cirrus CI builds from non-protected
  branches.

Once this one-time setup is complete, you can just keep pushing to your GitLab
repository as usual and you'll automatically get the additional CI coverage.


.. _Cirrus CI GitHub app: https://github.com/marketplace/cirrus-ci
.. _Cirrus CI settings: https://cirrus-ci.com/settings/profile/
.. _Cirrus CI: https://cirrus-ci.com/
.. _MinGW: http://mingw.org/
.. _cirrus-run: https://github.com/sio/cirrus-run/