1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00
libvirt/ci
Daniel P. Berrangé e4327557a4 ci: only run integration tests if $LIBVIRT_CI_INTEGRATION=1 is set
Right now the jobs have no rules so they will always be created in
a pipeline. If the user's fork has no runner configured, then the
jobs will never be able to execute and the pipeline will not finish.

Even on upstream, there might be times the runner has to be taken
offline for maint work, or unexpectedly fail. We need a quick way
to disable the integration tests if we decide we don't want to
have pipelines queued until the runner comes back online.

Both these problems can be addressed by requiring a environment
variable to be set

   LIBVIRT_CI_INTEGRATION=1

This can be done in the GitLab repo CI settings for permanent
enablement. Alternatively it can be set for individual
scheduled jobs, or using a push option

  git push -o ci.variable=LIBVIRT_CI_INTEGRATION=1

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2022-03-18 16:45:57 +01:00
..
cirrus ci: Refresh configuration 2022-01-03 16:52:25 +01:00
containers Add Alpine builds to CI 2022-03-17 11:28:40 +01:00
build.sh ci: Specify the shebang sequence for build.sh 2021-02-12 17:01:41 +01:00
gitlab.yml ci: manifest: Publish RPMs as artifacts on CentOS Stream and Fedoras 2022-03-17 16:09:53 +01:00
helper ci: remove obsolete logic for refreshing containers/cirrus 2021-09-10 13:36:12 +01:00
integration.yml ci: only run integration tests if $LIBVIRT_CI_INTEGRATION=1 is set 2022-03-18 16:45:57 +01:00
Makefile ci: helper: Rewrite image listing to Python 2021-03-19 11:47:26 +01:00
manifest.yml ci: manifest: Publish RPMs as artifacts on CentOS Stream and Fedoras 2022-03-17 16:09:53 +01:00
README.rst ci: Restore information about Coverity integration 2021-09-14 18:56:35 +02:00
util.py ci: Avoid use of magic constants 2021-09-14 18:56:49 +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;

* it may be necessary to push an empty ``.cirrus.yml`` file to your github fork
  for Cirrus CI to properly recognize the project. You can check whether
  Cirrus CI knows about your project by navigating to:

  ``https://cirrus-ci.com/yourusername/libvirt``

* 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/


Coverity scan integration
=========================

This will be used only by the main repository for master branch by running
scheduled pipeline in GitLab.

The service is proved by `Coverity Scan`_ and requires that the project is
registered there to get free coverity analysis which we already have for
`libvirt project`_.

To run the coverity job it requires two new variables:

  * ``COVERITY_SCAN_PROJECT_NAME``, containing the `libvirt project`_
    name.

  * ``COVERITY_SCAN_TOKEN``, token visible to admins of `libvirt project`_


.. _Coverity Scan: https://scan.coverity.com/
.. _libvirt project: https://scan.coverity.com/projects/libvirt