From a1002bd93a64f89421e71bdb539377285ef2b47f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 10 Dec 2020 20:08:00 +0100 Subject: gitlab-ci: enable test build on alpine linux Alpine is especially interesting because it uses musl as libc. The build does not yet succeed. There are several issues that need to be fixed. However, it will be simpler to fix things, if we have tests in place -- even if at the moment they are known to be broken. See-also: https://git.alpinelinux.org/aports/tree/community/networkmanager?h=master --- .gitlab-ci.yml | 44 ++++++++++++++++++++++++++++++++---- .gitlab-ci/alpine-install.sh | 7 ++++++ .gitlab-ci/build.sh | 5 +++- .gitlab-ci/config.yml | 5 ++++ contrib/alpine/REQUIRED_PACKAGES | 49 ++++++++++++++++++++++++++++++++++++++++ contrib/scripts/nm-ci-run.sh | 18 ++++++++++++++- 6 files changed, 122 insertions(+), 6 deletions(-) create mode 100755 .gitlab-ci/alpine-install.sh create mode 100755 contrib/alpine/REQUIRED_PACKAGES diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b20d972996..3a35f64199 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,6 +10,10 @@ .templates_sha: &template_sha b18e53bf67b9ed493a006d83dbadd1ecc0daa61a # see https://docs.gitlab.com/ee/ci/yaml/#includefile include: + # Alpine container builder template + - project: 'freedesktop/ci-templates' + ref: *template_sha + file: '/templates/alpine.yml' # Centos container builder template - project: 'freedesktop/ci-templates' ref: *template_sha @@ -40,15 +44,17 @@ variables: # these tags should be updated each time the list of packages is updated # changing these will force rebuilding the associated image # Note: these tags have no meaning and are not tied to a particular NM version - FEDORA_TAG: '2020-11-17.0-4422fd99fcf1' - UBUNTU_TAG: '2020-11-17.0-7ba6b1ddf582' - DEBIAN_TAG: '2020-11-17.0-7ba6b1ddf582' - CENTOS_TAG: '2020-11-17.0-4422fd99fcf1' + FEDORA_TAG: '2020-11-17.0-cbb87607d569' + UBUNTU_TAG: '2020-11-17.0-45915bd6e380' + DEBIAN_TAG: '2020-11-17.0-45915bd6e380' + CENTOS_TAG: '2020-11-17.0-cbb87607d569' + ALPINE_TAG: '2020-11-17.0-8309a34970a3' FEDORA_EXEC: 'bash .gitlab-ci/fedora-install.sh' UBUNTU_EXEC: 'bash .gitlab-ci/debian-install.sh' DEBIAN_EXEC: 'bash .gitlab-ci/debian-install.sh' CENTOS_EXEC: 'bash .gitlab-ci/fedora-install.sh' + ALPINE_EXEC: 'bash .gitlab-ci/alpine-install.sh' .nm_artifacts: variables: @@ -305,6 +311,16 @@ centos:8.2.2004@container-prep: FDO_DISTRIBUTION_TAG: $CENTOS_TAG FDO_DISTRIBUTION_EXEC: $CENTOS_EXEC +alpine:latest@container-prep: + extends: + - .fdo.container-build@alpine + stage: prep + variables: + GIT_STRATEGY: none + FDO_DISTRIBUTION_VERSION: 'latest' + FDO_DISTRIBUTION_TAG: $ALPINE_TAG + FDO_DISTRIBUTION_EXEC: $ALPINE_EXEC + ################################################################# # # # container clean stage # @@ -546,6 +562,15 @@ centos:8.2.2004@container-clean: FDO_DISTRIBUTION_VERSION: '8.2.2004' FDO_DISTRIBUTION_TAG: $CENTOS_TAG +alpine:latest@container-clean: + extends: + - .container-clean + variables: + GIT_STRATEGY: none + CURRENT_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/alpine/$FDO_DISTRIBUTION_VERSION:$FDO_DISTRIBUTION_TAG + FDO_DISTRIBUTION_VERSION: 'latest' + FDO_DISTRIBUTION_TAG: $ALPINE_TAG + ################################################################# # # @@ -819,6 +844,17 @@ t_centos:8.2.2004: - "centos:8.2.2004@container-prep" when: manual +t_alpine:latest: + extends: + - .build@template + - .fdo.distribution-image@alpine + variables: + FDO_DISTRIBUTION_VERSION: 'latest' + FDO_DISTRIBUTION_TAG: $ALPINE_TAG + needs: + - "alpine:latest@container-prep" + when: manual + ################################################################# # # # specific jobs # diff --git a/.gitlab-ci/alpine-install.sh b/.gitlab-ci/alpine-install.sh new file mode 100755 index 0000000000..8df82ce1f1 --- /dev/null +++ b/.gitlab-ci/alpine-install.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -ex + +./contrib/alpine/REQUIRED_PACKAGES + +ln -snf elogind/systemd /usr/include/systemd diff --git a/.gitlab-ci/build.sh b/.gitlab-ci/build.sh index fc118b8998..a183aa1f07 100755 --- a/.gitlab-ci/build.sh +++ b/.gitlab-ci/build.sh @@ -4,20 +4,23 @@ set -ex IS_FEDORA=0 IS_CENTOS=0 +IS_ALPINE=0 grep -q '^NAME=.*\(CentOS\)' /etc/os-release && IS_CENTOS=1 grep -q '^NAME=.*\(Fedora\)' /etc/os-release && IS_FEDORA=1 +grep -q '^NAME=.*\(Alpine\)' /etc/os-release && IS_ALPINE=1 do_clean() { git clean -fdx } uname -a -locale -a +! command -v locale &>/dev/null || locale -a env meson --version ! command -v dpkg &>/dev/null || dpkg -l ! command -v yum &>/dev/null || yum list installed +! command -v apk &>/dev/null || apk -v info # The formatting depends on the version of python black. # We have a dedicated test that checks our formatting, which diff --git a/.gitlab-ci/config.yml b/.gitlab-ci/config.yml index 201828379c..7efe1b6730 100644 --- a/.gitlab-ci/config.yml +++ b/.gitlab-ci/config.yml @@ -55,6 +55,11 @@ distributions: - '7.9.2009' - '8.1.1911' - '8.2.2004' + - name: alpine + tag: *default_tag + base_type: alpine + versions: + - 'latest' # specifies which of the above distros is used as source for pages pages_build: diff --git a/contrib/alpine/REQUIRED_PACKAGES b/contrib/alpine/REQUIRED_PACKAGES new file mode 100755 index 0000000000..6c9ad8deba --- /dev/null +++ b/contrib/alpine/REQUIRED_PACKAGES @@ -0,0 +1,49 @@ +#!/bin/sh + +set -ex + +apk update + +apk add \ + 'alpine-sdk' \ + 'autoconf' \ + 'automake' \ + 'bash' \ + 'clang' \ + 'curl-dev' \ + 'dbus' \ + 'dbus-glib-dev' \ + 'elogind-dev' \ + 'eudev-dev' \ + 'gcc' \ + 'git' \ + 'gnutls-dev' \ + 'gobject-introspection-dev' \ + 'gtk-doc' \ + 'intltool' \ + 'iptables' \ + 'jansson-dev' \ + 'libgudev-dev' \ + 'libndp-dev' \ + 'libnl3-dev' \ + 'libpsl-dev' \ + 'libsoup-dev' \ + 'libteam-dev' \ + 'libtool' \ + 'linux-headers' \ + 'make' \ + 'meson' \ + 'mobile-broadband-provider-info' \ + 'modemmanager-dev' \ + 'musl-dev' \ + 'newt-dev' \ + 'nss-dev' \ + 'polkit-dev' \ + 'ppp' \ + 'ppp-dev' \ + 'py3-gobject3' \ + 'python3' \ + 'readline-dev' \ + 'util-linux-dev' \ + 'vala' \ + 'vim' diff --git a/contrib/scripts/nm-ci-run.sh b/contrib/scripts/nm-ci-run.sh index 10b731c46d..0a87beaa5f 100755 --- a/contrib/scripts/nm-ci-run.sh +++ b/contrib/scripts/nm-ci-run.sh @@ -7,7 +7,7 @@ # - CFLAGS # - WITH_DOCS -set -exv +set -ex die() { printf "%s\n" "$@" @@ -41,6 +41,13 @@ if command -v ccache &>/dev/null; then export PATH="/usr/lib64/ccache:/usr/lib/ccache${PATH:+:${PATH}}" fi +IS_FEDORA=0 +IS_CENTOS=0 +IS_ALPINE=0 +grep -q '^NAME=.*\(CentOS\)' /etc/os-release && IS_CENTOS=1 +grep -q '^NAME=.*\(Fedora\)' /etc/os-release && IS_FEDORA=1 +grep -q '^NAME=.*\(Alpine\)' /etc/os-release && IS_ALPINE=1 + ############################################################################### if [ "$BUILD_TYPE" == meson ]; then @@ -58,6 +65,9 @@ _WITH_WERROR=1 _WITH_LIBTEAM="$_TRUE" _WITH_DOCS="$_TRUE" _WITH_SYSTEMD_LOGIND="$_TRUE" +if [ $IS_ALPINE = 1 ]; then + _WITH_SYSTEMD_LOGIND="$_FALSE" +fi if [ "$NMTST_SEED_RAND" != "" ]; then export NMTST_SEED_RAND= @@ -133,9 +143,15 @@ run_autotools() { else _WITH_WERROR_VAL="yes" fi + DISABLE_DEPENDENCY_TRACKING= + if [ $IS_ALPINE = 1 ]; then + DISABLE_DEPENDENCY_TRACKING='--disable-dependency-tracking' + fi pushd ./build ../configure \ --prefix="$PWD/INST" \ + $DISABLE_DEPENDENCY_TRACKING \ + \ --enable-introspection=$_WITH_DOCS \ --enable-gtk-doc=$_WITH_DOCS \ --with-systemd-logind=$_WITH_SYSTEMD_LOGIND \ -- cgit v1.2.1