6aac43
From b13e8ee2caaa84046e25a73e52dedb9c0f5c57a3 Mon Sep 17 00:00:00 2001
6aac43
From: Pavel Valena <pvalena@redhat.com>
6aac43
Date: Tue, 12 Jul 2022 14:12:04 +0200
6aac43
Subject: [PATCH] ci: all layered RHEL-9 changes
d1a34d
6aac43
 - previous downstream changes
6aac43
 - use dracut.spec as submitted in the PR
6aac43
 - sync selected changes from upstream
6aac43
 - add new-main for pull-requests temporarily
6aac43
6aac43
rhel-only
6aac43
Related: #2066816
d1a34d
---
6aac43
 .github/workflows/container.yml               |  7 ++--
6aac43
 .github/workflows/differential-shellcheck.yml | 19 ++++++++++
6aac43
 .github/workflows/integration.yml             | 47 ++++++++++++++++++++++--
6aac43
 .github/workflows/lint.yml                    |  4 +-
6aac43
 .packit.yml                                   | 36 ++++++++++++++++++
6aac43
 test/container/Dockerfile-CentOS-9-Stream     | 53 +++++++++++++++++++++++++++
6aac43
 6 files changed, 158 insertions(+), 8 deletions(-)
d1a34d
6aac43
diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml
6aac43
index 03c9c5ec..99d57f5b 100644
6aac43
--- a/.github/workflows/container.yml
6aac43
+++ b/.github/workflows/container.yml
6aac43
@@ -3,12 +3,12 @@ on:
6aac43
     schedule:
6aac43
         -  cron: '30 11 * * *'   # every day at 4:40
6aac43
     push:
6aac43
-        branches: [ master ]
6aac43
+        branches: [ main ]
6aac43
         paths:
6aac43
             - 'test/container/**'
6aac43
             - '.github/workflows/container.yml'
6aac43
     pull_request:
6aac43
-        branches: [ master ]
6aac43
+        branches: [ main new-main ]
6aac43
         paths:
6aac43
             - 'test/container/**'
6aac43
             - '.github/workflows/container.yml'
6aac43
@@ -31,6 +31,7 @@ jobs:
6aac43
                     - { dockerfile: 'Dockerfile-Fedora-latest',     tag: 'fedora:latest' }
6aac43
                     - { dockerfile: 'Dockerfile-OpenSuse-latest',   tag: 'opensuse:latest' }
6aac43
                     - { dockerfile: 'Dockerfile-Arch',              tag: 'arch:latest' }
6aac43
+                    - { dockerfile: 'Dockerfile-CentOS-9-Stream',   tag: 'centos:stream9' }
6aac43
                     - { dockerfile: 'Dockerfile-Debian',            tag: 'debian:latest' }
6aac43
         steps:
6aac43
             -   name: Check out the repo
6aac43
@@ -49,5 +50,5 @@ jobs:
6aac43
                 uses: docker/build-push-action@v2
6aac43
                 with:
6aac43
                     file: test/container/${{ matrix.config.dockerfile }}
6aac43
-                    tags: ghcr.io/dracutdevs/${{ matrix.config.tag }}
6aac43
+                    tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.config.tag }}
6aac43
                     push: ${{ github.event_name == 'push' ||  github.event_name == 'schedule' }}
6aac43
diff --git a/.github/workflows/differential-shellcheck.yml b/.github/workflows/differential-shellcheck.yml
6aac43
new file mode 100644
6aac43
index 00000000..c4b05fad
6aac43
--- /dev/null
6aac43
+++ b/.github/workflows/differential-shellcheck.yml
6aac43
@@ -0,0 +1,19 @@
6aac43
+name: Differential ShellCheck
6aac43
+on:
6aac43
+  pull_request:
6aac43
+    branches: [ main new-main ]
6aac43
+
6aac43
+jobs:
6aac43
+  test:
6aac43
+    runs-on: ubuntu-20.04
6aac43
+
6aac43
+    steps: 
6aac43
+      - name: Repository checkout
6aac43
+        uses: actions/checkout@v3
6aac43
+        with:
6aac43
+          fetch-depth: 0
6aac43
+
6aac43
+      - name: Differential ShellCheck
6aac43
+        uses: redhat-plumbers-in-action/differential-shellcheck@v2
6aac43
+        with:
6aac43
+          token: ${{ secrets.GITHUB_TOKEN }}
6aac43
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
6aac43
index 3d78555f..aa354e3e 100644
6aac43
--- a/.github/workflows/integration.yml
6aac43
+++ b/.github/workflows/integration.yml
6aac43
@@ -2,7 +2,7 @@ name: Integration Test
6aac43
 
6aac43
 on:
6aac43
     pull_request:
6aac43
-        branches: [ master ]
6aac43
+        branches: [ main new-main ]
6aac43
 
6aac43
 jobs:
6aac43
     basic:
6aac43
@@ -24,7 +24,7 @@ jobs:
6aac43
                 ]
6aac43
             fail-fast: false
6aac43
         container:
6aac43
-            image: ghcr.io/dracutdevs/${{ matrix.container }}
6aac43
+            image: ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}
6aac43
             options: "--privileged -v /dev:/dev"
6aac43
         steps:
6aac43
             -   name: "Checkout Repository"
6aac43
@@ -69,7 +69,48 @@ jobs:
6aac43
                 ]
6aac43
             fail-fast: false
6aac43
         container:
6aac43
-            image: ghcr.io/dracutdevs/${{ matrix.container }}
6aac43
+            image: ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}
6aac43
+            options: "--privileged -v /dev:/dev"
6aac43
+        steps:
6aac43
+            -   name: "Checkout Repository"
6aac43
+                uses: actions/checkout@v2
6aac43
+                with:
6aac43
+                    fetch-depth: 0
6aac43
+
6aac43
+            -   name: "${{ matrix.container }} TEST-${{ matrix.test }}"
6aac43
+                run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
6aac43
+    centos-9-stream:
6aac43
+        runs-on: ubuntu-latest
6aac43
+        timeout-minutes: 45
6aac43
+        concurrency:
6aac43
+            group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}
6aac43
+            cancel-in-progress: true
6aac43
+        strategy:
6aac43
+            matrix:
6aac43
+                container: [
6aac43
+                        "centos:stream9",
6aac43
+                ]
6aac43
+                # Disabled tests (due to dropped packages in RHEL/CentOS):
6aac43
+                # 03, 04, 15: requires btrfs
6aac43
+                # 14: requires dmraid
6aac43
+                # 30, 31, 35, 36: requires scsi-target-utils
6aac43
+                test: [
6aac43
+                        "01",
6aac43
+                        "02",
6aac43
+                        "10",
6aac43
+                        "11",
6aac43
+                        "12",
6aac43
+                        "13",
6aac43
+                        "17",
6aac43
+                        "20",
6aac43
+                        "21",
6aac43
+                        "40",
6aac43
+                        "41",
6aac43
+                        "98",
6aac43
+                ]
6aac43
+            fail-fast: false
6aac43
+        container:
6aac43
+            image: ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}
6aac43
             options: "--privileged -v /dev:/dev"
6aac43
         steps:
6aac43
             -   name: "Checkout Repository"
6aac43
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
6aac43
index 7b1b8ee7..5e3a299f 100644
6aac43
--- a/.github/workflows/lint.yml
6aac43
+++ b/.github/workflows/lint.yml
6aac43
@@ -2,9 +2,9 @@ name: Lint
6aac43
 
6aac43
 on:
6aac43
   push:
6aac43
-    branches: [ master ]
6aac43
+    branches: [ main ]
6aac43
   pull_request:
6aac43
-    branches: [ master ]
6aac43
+    branches: [ main new-main ]
6aac43
 
6aac43
 jobs:
6aac43
   lint-c:
d1a34d
diff --git a/.packit.yml b/.packit.yml
6aac43
new file mode 100644
6aac43
index 00000000..86ba83d2
6aac43
--- /dev/null
d1a34d
+++ b/.packit.yml
6aac43
@@ -0,0 +1,36 @@
d1a34d
+---
6aac43
+# This file is part of dracut.
6aac43
+# SPDX-License-Identifier: GPL-2.0-or-later
d1a34d
+#
d1a34d
+# vi:ts=2 sw=2 et:
d1a34d
+#
d1a34d
+# Docs: https://packit.dev/docs/
6aac43
+
6aac43
+specfile_path: pkgbuild/dracut.spec
d1a34d
+synced_files:
d1a34d
+  - .packit.yaml
6aac43
+upstream_package_name: dracut
6aac43
+downstream_package_name: dracut
d1a34d
+upstream_tag_template: "{version}"
6aac43
+
d1a34d
+actions:
d1a34d
+  post-upstream-clone:
6aac43
+    # Use the current specfile
6aac43
+    - "cp pkgbuild/dracut.spec ."
6aac43
+
d1a34d
+# Available targets can be listed via `copr-cli list-chroots`
6aac43
+jobs:
d1a34d
+# Build test
6aac43
+- job: copr_build
6aac43
+  trigger: pull_request
6aac43
+  metadata:
6aac43
+    targets:
6aac43
+      - centos-stream-9-x86_64
6aac43
+      - centos-stream-9-aarch64
d1a34d
+
d1a34d
+# Run tests (via testing farm)
d1a34d
+- job: tests
d1a34d
+  trigger: pull_request
6aac43
+  metadata:
6aac43
+    targets:
6aac43
+      - centos-stream-9-x86_64
6aac43
diff --git a/test/container/Dockerfile-CentOS-9-Stream b/test/container/Dockerfile-CentOS-9-Stream
6aac43
new file mode 100644
6aac43
index 00000000..c9a96020
6aac43
--- /dev/null
6aac43
+++ b/test/container/Dockerfile-CentOS-9-Stream
6aac43
@@ -0,0 +1,53 @@
6aac43
+FROM quay.io/centos/centos:stream9
6aac43
+
6aac43
+MAINTAINER https://github.com/dracutdevs/dracut
6aac43
+
6aac43
+ENV container docker
6aac43
+LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE"
6aac43
+
6aac43
+RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh
6aac43
+
6aac43
+# Install needed packages for the dracut CI container
6aac43
+# FIXME: properly re-add dash once C9S EPEL is available
6aac43
+RUN dnf -y install --enablerepo crb --setopt=install_weak_deps=False \
6aac43
+    http://mirrors.kernel.org/fedora/releases/34/Everything/x86_64/os/Packages/d/dash-0.5.10.2-8.fc34.x86_64.rpm \
6aac43
+    qemu-kvm \
6aac43
+    NetworkManager \
6aac43
+    asciidoc \
6aac43
+    bash-completion \
6aac43
+    bzip2 \
6aac43
+    cryptsetup \
6aac43
+    dbus-daemon \
6aac43
+    dhcp-client \
6aac43
+    dhcp-server \
6aac43
+    e2fsprogs \
6aac43
+    gcc \
6aac43
+    git \
6aac43
+    iproute \
6aac43
+    iputils \
6aac43
+    iscsi-initiator-utils \
6aac43
+    kbd \
6aac43
+    kernel \
6aac43
+    kmod-devel \
6aac43
+    lvm2 \
6aac43
+    make \
6aac43
+    mdadm \
6aac43
+    nfs-utils \
6aac43
+    pigz \
6aac43
+    rpm-build \
6aac43
+    strace \
6aac43
+    sudo \
6aac43
+    tar \
6aac43
+    tcpdump \
6aac43
+    wget \
6aac43
+    which \
6aac43
+    xz \
6aac43
+    && dnf -y update && dnf clean all
6aac43
+
6aac43
+# C9S ships only qemu-kvm, but it disables the KVM accel when it's not
6aac43
+# available
6aac43
+RUN ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu-kvm && \
6aac43
+    ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu-system-$(uname -m)
6aac43
+
6aac43
+# Set default command
6aac43
+CMD ["/usr/bin/bash"]
d1a34d