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