|
|
a9f26f |
From e2c7b61f97465b26c598d655c8717403c0a73726 Mon Sep 17 00:00:00 2001
|
|
|
a9f26f |
From: Frantisek Sumsal <frantisek@sumsal.cz>
|
|
|
a9f26f |
Date: Sat, 13 Nov 2021 16:35:23 +0100
|
|
|
a9f26f |
Subject: [PATCH] ci: introduce C8S based GHA CI
|
|
|
a9f26f |
|
|
|
a9f26f |
Loosely based on the upstream dracut CI to make things simpler.
|
|
|
a9f26f |
|
|
|
a9f26f |
rhel-only
|
|
|
a9f26f |
---
|
|
|
a9f26f |
.github/workflows/container.yml | 52 +++++++++++++++++++++++++++++
|
|
|
a9f26f |
.github/workflows/integration.yml | 48 +++++++++++++++++++++++++++
|
|
|
a9f26f |
test/container/Dockerfile-CentOS-8-Stream | 54 +++++++++++++++++++++++++++++++
|
|
|
a9f26f |
tools/test-github.sh | 49 ++++++++++++++++++++++++++++
|
|
|
a9f26f |
4 files changed, 203 insertions(+)
|
|
|
a9f26f |
|
|
|
a9f26f |
diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml
|
|
|
a9f26f |
new file mode 100644
|
|
|
a9f26f |
index 00000000..0a4c000f
|
|
|
a9f26f |
--- /dev/null
|
|
|
a9f26f |
+++ b/.github/workflows/container.yml
|
|
|
a9f26f |
@@ -0,0 +1,52 @@
|
|
|
a9f26f |
+name: Container
|
|
|
a9f26f |
+on:
|
|
|
a9f26f |
+ schedule:
|
|
|
a9f26f |
+ - cron: '30 11 * * *'
|
|
|
a9f26f |
+ push:
|
|
|
a9f26f |
+ branches: [ main ]
|
|
|
a9f26f |
+ paths:
|
|
|
a9f26f |
+ - 'test/container/**'
|
|
|
a9f26f |
+ - '.github/workflows/container.yml'
|
|
|
a9f26f |
+ pull_request:
|
|
|
a9f26f |
+ branches: [ main ]
|
|
|
a9f26f |
+ paths:
|
|
|
a9f26f |
+ - 'test/container/**'
|
|
|
a9f26f |
+ - '.github/workflows/container.yml'
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+permissions:
|
|
|
a9f26f |
+ packages: write
|
|
|
a9f26f |
+ contents: read
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+jobs:
|
|
|
a9f26f |
+ push_to_registry:
|
|
|
a9f26f |
+ name: Build and push containers image to GitHub Packages
|
|
|
a9f26f |
+ runs-on: ubuntu-latest
|
|
|
a9f26f |
+ concurrency:
|
|
|
a9f26f |
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.config.dockerfile }}
|
|
|
a9f26f |
+ cancel-in-progress: true
|
|
|
a9f26f |
+ strategy:
|
|
|
a9f26f |
+ fail-fast: false
|
|
|
a9f26f |
+ matrix:
|
|
|
a9f26f |
+ config:
|
|
|
a9f26f |
+ # Use a prefixed image name to not conflict with the "centos"
|
|
|
a9f26f |
+ # image from redhat-plumbers/dracut-rhel9
|
|
|
a9f26f |
+ - { dockerfile: 'Dockerfile-CentOS-8-Stream', tag: 'rhel8_centos:stream8' }
|
|
|
a9f26f |
+ steps:
|
|
|
a9f26f |
+ - name: Check out the repo
|
|
|
a9f26f |
+ uses: actions/checkout@v2
|
|
|
a9f26f |
+ - name: Set up Docker Buildx
|
|
|
a9f26f |
+ uses: docker/setup-buildx-action@v1
|
|
|
a9f26f |
+# with:
|
|
|
a9f26f |
+# buildkitd-flags: --debug
|
|
|
a9f26f |
+ - name: Login to GitHub Container Registry
|
|
|
a9f26f |
+ uses: docker/login-action@v1
|
|
|
a9f26f |
+ with:
|
|
|
a9f26f |
+ registry: ghcr.io
|
|
|
a9f26f |
+ username: ${{ github.repository_owner }}
|
|
|
a9f26f |
+ password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
a9f26f |
+ - name: Build and Push Container
|
|
|
a9f26f |
+ uses: docker/build-push-action@v2
|
|
|
a9f26f |
+ with:
|
|
|
a9f26f |
+ file: test/container/${{ matrix.config.dockerfile }}
|
|
|
a9f26f |
+ tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.config.tag }}
|
|
|
a9f26f |
+ push: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
|
|
|
a9f26f |
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
|
|
|
a9f26f |
new file mode 100644
|
|
|
a9f26f |
index 00000000..80a856a2
|
|
|
a9f26f |
--- /dev/null
|
|
|
a9f26f |
+++ b/.github/workflows/integration.yml
|
|
|
a9f26f |
@@ -0,0 +1,48 @@
|
|
|
a9f26f |
+name: Integration Test
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+on:
|
|
|
a9f26f |
+ pull_request:
|
|
|
a9f26f |
+ branches: [ main ]
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+jobs:
|
|
|
a9f26f |
+ centos-8-stream:
|
|
|
a9f26f |
+ runs-on: ubuntu-latest
|
|
|
a9f26f |
+ timeout-minutes: 45
|
|
|
a9f26f |
+ concurrency:
|
|
|
a9f26f |
+ group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}
|
|
|
a9f26f |
+ cancel-in-progress: true
|
|
|
a9f26f |
+ strategy:
|
|
|
a9f26f |
+ matrix:
|
|
|
a9f26f |
+ container: [
|
|
|
a9f26f |
+ "rhel8_centos:stream8",
|
|
|
a9f26f |
+ ]
|
|
|
a9f26f |
+ # Disabled tests (due to dropped packages in RHEL/CentOS):
|
|
|
a9f26f |
+ # 03, 04, 15: requires btrfs
|
|
|
a9f26f |
+ # 14: requires dmraid
|
|
|
a9f26f |
+ # 30, 31, 35, 36: requires scsi-target-utils
|
|
|
a9f26f |
+ test: [
|
|
|
a9f26f |
+ "01",
|
|
|
a9f26f |
+ "02",
|
|
|
a9f26f |
+ "10",
|
|
|
a9f26f |
+ "11",
|
|
|
a9f26f |
+ "12",
|
|
|
a9f26f |
+ "13",
|
|
|
a9f26f |
+ "17",
|
|
|
a9f26f |
+ "20",
|
|
|
a9f26f |
+ #"21", needs backport (NFS + NM)
|
|
|
a9f26f |
+ "40",
|
|
|
a9f26f |
+ #"41", needws backport (NBD + NM)
|
|
|
a9f26f |
+ "98",
|
|
|
a9f26f |
+ ]
|
|
|
a9f26f |
+ fail-fast: false
|
|
|
a9f26f |
+ container:
|
|
|
a9f26f |
+ image: ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}
|
|
|
a9f26f |
+ options: "--privileged -v /dev:/dev"
|
|
|
a9f26f |
+ steps:
|
|
|
a9f26f |
+ - name: "Checkout Repository"
|
|
|
a9f26f |
+ uses: actions/checkout@v2
|
|
|
a9f26f |
+ with:
|
|
|
a9f26f |
+ fetch-depth: 0
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+ - name: "${{ matrix.container }} TEST-${{ matrix.test }}"
|
|
|
a9f26f |
+ run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
|
|
|
a9f26f |
diff --git a/test/container/Dockerfile-CentOS-8-Stream b/test/container/Dockerfile-CentOS-8-Stream
|
|
|
a9f26f |
new file mode 100644
|
|
|
a9f26f |
index 00000000..0eda4a7e
|
|
|
a9f26f |
--- /dev/null
|
|
|
a9f26f |
+++ b/test/container/Dockerfile-CentOS-8-Stream
|
|
|
a9f26f |
@@ -0,0 +1,54 @@
|
|
|
a9f26f |
+FROM quay.io/centos/centos:stream8
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+MAINTAINER https://github.com/dracutdevs/dracut
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+ENV container docker
|
|
|
a9f26f |
+LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE"
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+# Install needed packages for the dracut CI container
|
|
|
a9f26f |
+RUN dnf -y install epel-release && \
|
|
|
a9f26f |
+ dnf -y install --enablerepo powertools --enablerepo epel --setopt=install_weak_deps=False \
|
|
|
a9f26f |
+ qemu-kvm \
|
|
|
a9f26f |
+ NetworkManager \
|
|
|
a9f26f |
+ asciidoc \
|
|
|
a9f26f |
+ bash-completion \
|
|
|
a9f26f |
+ bzip2 \
|
|
|
a9f26f |
+ cryptsetup \
|
|
|
a9f26f |
+ dash \
|
|
|
a9f26f |
+ dbus-daemon \
|
|
|
a9f26f |
+ dhcp-client \
|
|
|
a9f26f |
+ dhcp-server \
|
|
|
a9f26f |
+ e2fsprogs \
|
|
|
a9f26f |
+ gcc \
|
|
|
a9f26f |
+ git \
|
|
|
a9f26f |
+ iproute \
|
|
|
a9f26f |
+ iputils \
|
|
|
a9f26f |
+ iscsi-initiator-utils \
|
|
|
a9f26f |
+ kbd \
|
|
|
a9f26f |
+ kernel \
|
|
|
a9f26f |
+ kmod-devel \
|
|
|
a9f26f |
+ lvm2 \
|
|
|
a9f26f |
+ make \
|
|
|
a9f26f |
+ mdadm \
|
|
|
a9f26f |
+ nfs-utils \
|
|
|
a9f26f |
+ pigz \
|
|
|
a9f26f |
+ python3-imgcreate \
|
|
|
a9f26f |
+ rpm-build \
|
|
|
a9f26f |
+ strace \
|
|
|
a9f26f |
+ sudo \
|
|
|
a9f26f |
+ tar \
|
|
|
a9f26f |
+ tcpdump \
|
|
|
a9f26f |
+ wget \
|
|
|
a9f26f |
+ which \
|
|
|
a9f26f |
+ xz \
|
|
|
a9f26f |
+ && dnf -y update && dnf clean all
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+# CentOS 8 ships only qemu-kvm, but it disables the KVM accel when it's not
|
|
|
a9f26f |
+# available
|
|
|
a9f26f |
+RUN ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu-kvm && \
|
|
|
a9f26f |
+ ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu-system-$(uname -m)
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+# Set default command
|
|
|
a9f26f |
+CMD ["/usr/bin/bash"]
|
|
|
a9f26f |
diff --git a/tools/test-github.sh b/tools/test-github.sh
|
|
|
a9f26f |
new file mode 100755
|
|
|
a9f26f |
index 00000000..eab59dcc
|
|
|
a9f26f |
--- /dev/null
|
|
|
a9f26f |
+++ b/tools/test-github.sh
|
|
|
a9f26f |
@@ -0,0 +1,49 @@
|
|
|
a9f26f |
+#!/bin/bash
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+set -ex
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+[[ -d ${0%/*} ]] && cd "${0%/*}"/../
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+RUN_ID="$1"
|
|
|
a9f26f |
+TESTS=$2
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+./configure
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+NCPU=$(getconf _NPROCESSORS_ONLN)
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+if ! [[ $TESTS ]]; then
|
|
|
a9f26f |
+ # GitHub workflows fetch a clone of the dracut repository which doesn't
|
|
|
a9f26f |
+ # contain git tags, thus "breaking" the RPM build in certain situations
|
|
|
a9f26f |
+ # i.e.:
|
|
|
a9f26f |
+ # DRACUT_MAIN_VERSION in Makefile is defined as an output of `git describe`,
|
|
|
a9f26f |
+ # which in full git clone returns a tag with a numeric version. However,
|
|
|
a9f26f |
+ # without tags it returns SHA of the last commit, which later propagates into
|
|
|
a9f26f |
+ # `Provides:` attribute of the built RPM and can break dependency tree when
|
|
|
a9f26f |
+ # installed
|
|
|
a9f26f |
+ [[ -d .git ]] && git fetch --tags && git describe --tags
|
|
|
a9f26f |
+ make -j "$NCPU" all syncheck rpm logtee
|
|
|
a9f26f |
+else
|
|
|
a9f26f |
+ if [[ $TESTS == "99" ]]; then
|
|
|
a9f26f |
+ [[ -d .git ]] && git fetch --tags && git describe --tags
|
|
|
a9f26f |
+ make_docs=yes
|
|
|
a9f26f |
+ else
|
|
|
a9f26f |
+ make_docs=no
|
|
|
a9f26f |
+ fi
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+ make -j "$NCPU" enable_documentation=$make_docs all logtee
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+ cd test
|
|
|
a9f26f |
+
|
|
|
a9f26f |
+ # shellcheck disable=SC2012
|
|
|
a9f26f |
+ time LOGTEE_TIMEOUT_MS=590000 make \
|
|
|
a9f26f |
+ enable_documentation=$make_docs \
|
|
|
a9f26f |
+ KVERSION="$(
|
|
|
a9f26f |
+ cd /lib/modules
|
|
|
a9f26f |
+ ls -1 | tail -1
|
|
|
a9f26f |
+ )" \
|
|
|
a9f26f |
+ DRACUT_NO_XATTR=1 \
|
|
|
a9f26f |
+ TEST_RUN_ID="$RUN_ID" \
|
|
|
a9f26f |
+ ${TESTS:+TESTS="$TESTS"} \
|
|
|
a9f26f |
+ -k V=1 \
|
|
|
a9f26f |
+ check
|
|
|
a9f26f |
+fi
|
|
|
a9f26f |
|