Skip to content

Commit

Permalink
ci: test against supported rhel distribs
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Nov 14, 2021
1 parent ba35806 commit 5d98157
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,26 @@ jobs:
image: debian:sid
typ: debian
allow-failure: true
-
image: redhat/ubi8
typ: rhel
allow-failure: false
-
image: fedora:35
typ: rhel
allow-failure: false
-
image: centos:8
typ: rhel
allow-failure: false
-
image: rockylinux/rockylinux:8
typ: rhel
allow-failure: false
-
image: oraclelinux:8
typ: rhel
allow-failure: false
steps:
-
name: Checkout
Expand Down
13 changes: 12 additions & 1 deletion base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#syntax=docker/dockerfile:1.2
# syntax=docker/dockerfile:1.3-labs

ARG TEST_BASE_TYPE=alpine
ARG TEST_BASE_IMAGE=${TEST_BASE_TYPE}
ARG TEST_WITH_DARWIN=false
Expand Down Expand Up @@ -33,6 +34,16 @@ RUN --mount=type=cache,target=/pkg-cache \
WORKDIR /work

FROM ${TEST_BASE_IMAGE} AS test-base-rhel
RUN <<EOT
#!/usr/bin/env bash
if ! yum install -y epel-release; then
if . /etc/os-release 2>/dev/null; then
if [ "$ID" != "fedora" ]; then
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-${VERSION:0:1}.noarch.rpm
fi
fi
fi
EOT
RUN --mount=type=cache,target=/pkg-cache \
rm -rf /var/cache/yum && \
ln -s /pkg-cache /var/cache/yum && \
Expand Down
13 changes: 12 additions & 1 deletion base/test-info-rhel.bats
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@

load "assert"

vendor="rhel"
if grep <"/etc/redhat-release" "Fedora" 2>/dev/null >/dev/null; then
vendor="fedora"
elif grep <"/etc/redhat-release" "CentOS" 2>/dev/null >/dev/null; then
vendor="centos"
elif grep <"/etc/redhat-release" "Rocky Linux" 2>/dev/null >/dev/null; then
vendor="rocky"
elif [ -f "/etc/oracle-release" ] && grep <"/etc/oracle-release" "Oracle Linux" 2>/dev/null >/dev/null; then
vendor="ol"
fi

@test "vendor" {
assert_equal "fedora" "$(xx-info vendor)"
assert_equal "$vendor" "$(xx-info vendor)"
}

@test "rhel-arch" {
Expand Down

0 comments on commit 5d98157

Please sign in to comment.