Re: [libvirt PATCH 1/2] ci: Enable Cirrus CI integration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 08, 2020 at 05:42:32PM +0200, Andrea Bolognani wrote:
> We use cirrus-run to trigger Cirrus CI jobs from GitLab CI jobs,
> making it possible to extend our platform coverage to include
> FreeBSD without having to maintain our own runners; additionally,
> we'll be able to ditch Travis CI and, since results for Cirrus CI
> jobs are reflected back to the GitLab CI jobs that triggered them,
> we will be able to get all information from a single dashboard.
> 
> The FreeBSD and macOS job definitions can be improved further: for
> example, we will want to enable caching to speed up builds, and
> ultimately we should figure out a way to generate at least part of
> them, notably the list of packages to be installed, using lcitool.
> All of that will happen in later patches: for now, this is good
> enough to start using Cirrus CI.


> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 7113a1283c..bded69224b 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -38,6 +38,27 @@ stages:
>      - master
>      - /^ci-full-.*$/
>  
> +# Jobs that we delegate to Cirrus CI because they require an operating
> +# system other than Linux
> +.cirrus_build_default_job_template: &cirrus_build_default_job_definition
> +  stage: native_build
> +  image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:master
> +  script:
> +    - |
> +      if test -z "$CIRRUS_GITHUB_REPO" || test -z "$CIRRUS_API_TOKEN"; then
> +          echo "WARN: Cirrus CI integration not set up correctly for your account"
> +          echo "WARN: This job will be skipped"
> +          echo "WARN: See ci/README.rst for more information"
> +          exit 0
> +      fi

This will give a misleading impression that the macOS / FreeBSD
job has been run for a user's merge request. Instead we shoudl
do

> +    - cirrus-run ci/cirrus/$NAME.yml.j2

   only:
     variables:
       - $CIRRUS_GITHUB_REPO
       - $CIRRUS_API_TOKEN

this ensures the job is not even created if the contributor has not
configured things. Thus we can see from the list of jobs whether
the merge request has CI coverage of macOS/FreeBSD, instead of
having to read the job log to spot the warning.

> +
> +.cirrus_build_extra_job_template: &cirrus_build_extra_job_definition
> +  <<: *cirrus_build_default_job_definition
> +  only:
> +    - master
> +    - /^ci-full-.*$/
> +
>  

> diff --git a/ci/cirrus/freebsd-11.yml.j2 b/ci/cirrus/freebsd-11.yml.j2
> new file mode 100644
> index 0000000000..e8df443d21
> --- /dev/null
> +++ b/ci/cirrus/freebsd-11.yml.j2
> @@ -0,0 +1,73 @@
> +freebsd_instance:
> +  image_family: freebsd-11-3
> +
> +env:
> +  CI_REPOSITORY_URL: {{ CI_REPOSITORY_URL }}
> +  CI_COMMIT_REF_NAME: {{ CI_COMMIT_REF_NAME }}
> +  CI_COMMIT_SHA: {{ CI_COMMIT_SHA }}
> +
> +freebsd_11_task:
> +  install_script:
> +    - pkg install -y
> +          augeas
> +          autoconf
> +          automake
> +          avahi
> +          bash
> +          bash-completion
> +          ca_root_nss
> +          ccache
> +          chrony
> +          cppi
> +          curl
> +          cyrus-sasl
> +          dbus
> +          diskscrub
> +          dnsmasq
> +          fusefs-libs
> +          gdb
> +          gettext
> +          gettext-tools
> +          git
> +          glib
> +          gmake
> +          gnutls
> +          hal
> +          libpcap
> +          libpciaccess
> +          libssh
> +          libssh2
> +          libtool
> +          libxml2
> +          libxslt
> +          lsof
> +          meson
> +          ncurses
> +          ninja
> +          patch
> +          perl5
> +          pkgconf
> +          polkit
> +          py37-docutils
> +          py37-flake8
> +          py37-setuptools
> +          py37-wheel
> +          python3
> +          qemu-utils
> +          radvd
> +          readline
> +          screen
> +          sudo
> +          vim
> +          yajl
> +  clone_script:
> +    - git clone --depth 100 "$CI_REPOSITORY_URL" .
> +    - git fetch origin "$CI_COMMIT_REF_NAME"
> +    - git reset --hard "$CI_COMMIT_SHA"
> +  build_script:
> +    - mkdir build
> +    - cd build
> +    - ../autogen.sh --prefix=$(pwd)/install-root
> +    - gmake -j3
> +    - gmake -j3 install
> +    - gmake -j3 dist

For the dockerfiles, we're auto-generating using lcitool.

IIUC, we should have sufficient info avialable in lcitol that
we can wrote a command to generate this entire file, including
the build_script commands.

In fact eventually we could try to get to a point where we
auto-generate the .gitlab-ci.yml from lcitool.


> diff --git a/ci/cirrus/macos-1015.yml.j2 b/ci/cirrus/macos-1015.yml.j2
> new file mode 100644
> index 0000000000..d8aa9715d6
> --- /dev/null
> +++ b/ci/cirrus/macos-1015.yml.j2
> @@ -0,0 +1,38 @@
> +osx_instance:
> +  image: catalina-base
> +
> +env:
> +  CI_REPOSITORY_URL: {{ CI_REPOSITORY_URL }}
> +  CI_COMMIT_REF_NAME: {{ CI_COMMIT_REF_NAME }}
> +  CI_COMMIT_SHA: {{ CI_COMMIT_SHA }}
> +  PATH: /usr/local/opt/gettext/bin:/usr/local/opt/ccache/libexec:/usr/local/opt/rpcgen/bin:$PATH
> +  PKG_CONFIG_PATH: /usr/local/opt/libxml2/lib/pkgconfig
> +
> +macos_1015_task:
> +  install_script:
> +    - brew install
> +           autoconf
> +           automake
> +           ccache
> +           docutils
> +           glib
> +           gnutls
> +           libtool
> +           libxml2
> +           make
> +           pkg-config
> +           python
> +           rpcgen
> +           xz
> +           yajl

Obviously we'd need to define a mapping for macOS in lcitool
for this.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux