forked from redhat-plumbers/dracut-rhel8
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loosely based on the upstream dracut CI to make things simpler. rhel-only
- Loading branch information
Showing
4 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: Container | ||
on: | ||
schedule: | ||
- cron: '30 11 * * *' | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- 'test/container/**' | ||
- '.github/workflows/container.yml' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- 'test/container/**' | ||
- '.github/workflows/container.yml' | ||
|
||
permissions: | ||
packages: write | ||
contents: read | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Build and push containers image to GitHub Packages | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.config.dockerfile }} | ||
cancel-in-progress: true | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
# Use a prefixed image name to not conflict with the "centos" | ||
# image from redhat-plumbers/dracut-rhel9 | ||
- { dockerfile: 'Dockerfile-CentOS-8-Stream', tag: 'rhel8_centos:stream8' } | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v2 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
# with: | ||
# buildkitd-flags: --debug | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and Push Container | ||
uses: docker/build-push-action@v2 | ||
with: | ||
file: test/container/${{ matrix.config.dockerfile }} | ||
tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.config.tag }} | ||
push: ${{ github.event_name == 'push' || github.event_name == 'schedule' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Integration Test | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
centos-8-stream: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 45 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }} | ||
cancel-in-progress: true | ||
strategy: | ||
matrix: | ||
container: [ | ||
"rhel8_centos:stream8", | ||
] | ||
# Disabled tests (due to dropped packages in RHEL/CentOS): | ||
# 03, 04, 15: requires btrfs | ||
# 14: requires dmraid | ||
# 30, 31, 35, 36: requires scsi-target-utils | ||
test: [ | ||
"01", | ||
"02", | ||
"10", | ||
"11", | ||
"12", | ||
"13", | ||
"17", | ||
"20", | ||
#"21", needs backport (NFS + NM) | ||
"40", | ||
#"41", needws backport (NBD + NM) | ||
"98", | ||
] | ||
fail-fast: false | ||
container: | ||
image: ghcr.io/${{ github.repository_owner }}/${{ matrix.container }} | ||
options: "--privileged -v /dev:/dev" | ||
steps: | ||
- name: "Checkout Repository" | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: "${{ matrix.container }} TEST-${{ matrix.test }}" | ||
run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
FROM quay.io/centos/centos:stream8 | ||
|
||
MAINTAINER https://github.com/dracutdevs/dracut | ||
|
||
ENV container docker | ||
LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=host -e NAME=NAME -e IMAGE=IMAGE IMAGE" | ||
|
||
RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh | ||
|
||
# Install needed packages for the dracut CI container | ||
RUN dnf -y install epel-release && \ | ||
dnf -y install --enablerepo powertools --enablerepo epel --setopt=install_weak_deps=False \ | ||
qemu-kvm \ | ||
NetworkManager \ | ||
asciidoc \ | ||
bash-completion \ | ||
bzip2 \ | ||
cryptsetup \ | ||
dash \ | ||
dbus-daemon \ | ||
dhcp-client \ | ||
dhcp-server \ | ||
e2fsprogs \ | ||
gcc \ | ||
git \ | ||
iproute \ | ||
iputils \ | ||
iscsi-initiator-utils \ | ||
kbd \ | ||
kernel \ | ||
kmod-devel \ | ||
lvm2 \ | ||
make \ | ||
mdadm \ | ||
nfs-utils \ | ||
pigz \ | ||
python3-imgcreate \ | ||
rpm-build \ | ||
strace \ | ||
sudo \ | ||
tar \ | ||
tcpdump \ | ||
wget \ | ||
which \ | ||
xz \ | ||
&& dnf -y update && dnf clean all | ||
|
||
# CentOS 8 ships only qemu-kvm, but it disables the KVM accel when it's not | ||
# available | ||
RUN ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu-kvm && \ | ||
ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu-system-$(uname -m) | ||
|
||
# Set default command | ||
CMD ["/usr/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
[[ -d ${0%/*} ]] && cd "${0%/*}"/../ | ||
|
||
RUN_ID="$1" | ||
TESTS=$2 | ||
|
||
./configure | ||
|
||
NCPU=$(getconf _NPROCESSORS_ONLN) | ||
|
||
if ! [[ $TESTS ]]; then | ||
# GitHub workflows fetch a clone of the dracut repository which doesn't | ||
# contain git tags, thus "breaking" the RPM build in certain situations | ||
# i.e.: | ||
# DRACUT_MAIN_VERSION in Makefile is defined as an output of `git describe`, | ||
# which in full git clone returns a tag with a numeric version. However, | ||
# without tags it returns SHA of the last commit, which later propagates into | ||
# `Provides:` attribute of the built RPM and can break dependency tree when | ||
# installed | ||
[[ -d .git ]] && git fetch --tags && git describe --tags | ||
make -j "$NCPU" all syncheck rpm logtee | ||
else | ||
if [[ $TESTS == "99" ]]; then | ||
[[ -d .git ]] && git fetch --tags && git describe --tags | ||
make_docs=yes | ||
else | ||
make_docs=no | ||
fi | ||
|
||
make -j "$NCPU" enable_documentation=$make_docs all logtee | ||
|
||
cd test | ||
|
||
# shellcheck disable=SC2012 | ||
time LOGTEE_TIMEOUT_MS=590000 make \ | ||
enable_documentation=$make_docs \ | ||
KVERSION="$( | ||
cd /lib/modules | ||
ls -1 | tail -1 | ||
)" \ | ||
DRACUT_NO_XATTR=1 \ | ||
TEST_RUN_ID="$RUN_ID" \ | ||
${TESTS:+TESTS="$TESTS"} \ | ||
-k V=1 \ | ||
check | ||
fi |