Skip to content

Commit

Permalink
[ci] Add RHEL UBI9 as a new CI job
Browse files Browse the repository at this point in the history
Well, sort of.  UBI by itself does not provide all of the build
requirements.  Even when enabling EPEL.  Some things are from the
RHEL-9 CodeReady Builder repo, and that has been stripped down for UBI
(along with BaseOS and AppStream).

So, create a kind-of-UBI test environment.  I start with UBI9 then I
enable the CentOS Stream 9 BaseOS, AppStream, and CRB repos at a lower
cost than UBI repos.  Then install the build requirements and go from
there.

There does not appear to get the rest of RHEL-9 for UBI without
getting a subscription, and I can't enable that in GitHub Actions.  So
I will just glue CentOS Stream packages on the UBI and hope for the
best.  In most cases this should mean my UBI CI job is "released UBI9
plus what will be in the next y-release of RHEL-9".  Probably.

Signed-off-by: David Cantrell <dcantrell@redhat.com>
  • Loading branch information
dcantrell committed May 1, 2024
1 parent 44e6e37 commit c3dab63
Show file tree
Hide file tree
Showing 7 changed files with 170 additions and 1 deletion.
93 changes: 93 additions & 0 deletions .github/workflows/ubi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: RHEL UBI

on:
push:
branches: [ main ]
paths-ignore:
- AUTHORS.md
- CC-BY-4.0.txt
- CHANGES.md
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- COPYING
- COPYING.LIB
- HISTORY
- LICENSE-2.0.txt
- MISSING
- MIT.txt
- README.md
- RELEASE
- TODO
- 'contrib/**'
- 'data/**'
- 'doc/**'
- 'po/**'
- 'regress/**'

jobs:
centos:
# Use containers on their ubuntu latest image
runs-on: ubuntu-latest

strategy:
matrix:
container: ["registry.access.redhat.com/ubi9/ubi:latest"]

container:
image: ${{ matrix.container }}

# All of these steps run from within the main source
# directory, so think of that as your $PWD
steps:
# Requirements before the git clone can happen
- name: git clone requirements
run: |
case "${{ matrix.container }}" in
*ubi9)
# UBI by itself does not contain every BR we
# need, so supplement with CentOS Stream 9
if [ -d /etc/yum.repos.d ]; then
rm -f /etc/yum.repos.d/ubi.repo
else
mkdir -p /etc/yum.repos.d
fi
for c in BaseOS AppStream CRB ; do
echo "[c9s-${c}]" >> /etc/yum.repos.d/ubi.repo
echo "name = CentOS Stream 9 - ${c}" >> /etc/yum.repos.d/ubi.repo
echo "baseurl = https://mirror.stream.centos.org/9-stream/${c}/\$basearch/os/" >> /etc/yum.repos.d/ubi.repo
echo "cost = 100" >> /etc/yum.repos.d/ubi.repo
echo "enabled = 1" >> /etc/yum.repos.d/ubi.repo
echo "gpgcheck = 0" >> /etc/yum.repos.d/ubi.repo
echo >> /etc/yum.repos.d/ubi.repo
done
# Upgrade things
dnf upgrade -y
# Now enable EPEL and install git
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
dnf install -y git
;;
esac
# This means clone the git repo
- uses: actions/checkout@v4

# Within the container, install the dependencies, build,
# and run the test suite
- name: Build and run the test suite
run: |
# Install make(1) so we can use the instreqs target
dnf install -y make
# Install build dependencies and set up the target
make instreqs
# Build and run the test suite
make debug
make check
# Report coverage
ninja -C build coverage && ( curl -s https://codecov.io/bash | bash ) || :
2 changes: 2 additions & 0 deletions osdeps/ubi9/defs.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PKG_CMD = dnf install -y
PIP_CMD = pip3 install -I
5 changes: 5 additions & 0 deletions osdeps/ubi9/pip.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cpp-coveralls
gcovr
PyYAML
rpmfluff
timeout-decorator
10 changes: 10 additions & 0 deletions osdeps/ubi9/post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin

# Install 32-bit development files on x86_64 systems
if [ "$(uname -m)" = "x86_64" ]; then
dnf install -y glibc-devel.i686 glibc.i686 libgcc.i686
fi

# Update clamav database
freshclam
6 changes: 6 additions & 0 deletions osdeps/ubi9/pre.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
PATH=/usr/bin

# Update pip and setuptools
dnf install -y python3-pip
pip3 install --upgrade pip setuptools
49 changes: 49 additions & 0 deletions osdeps/ubi9/reqs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
annobin
bash
clamav-data
clamav-devel
clamav-update
CUnit
CUnit-devel
desktop-file-utils
elfutils-devel
file-devel
gcc
gettext
gettext-devel
git
glibc-devel
json-c-devel
kernel-core
kernel-devel
kmod-devel
ksh
libabigail
libarchive-devel
libcap-devel
libcdson-devel
libcurl-devel
libffi-devel
libicu-devel
libmandoc-devel
libxml2-devel
libyaml-devel
make
meson
ninja-build
openssl-devel
patchelf
python3-devel
python3-pip
python3-pyyaml
python3-rpm
rc
rpm-build
rpm-devel
sssd-client
tcsh
valgrind
xhtml1-dtds
xmlrpc-c-devel
zlib-devel
zsh
6 changes: 5 additions & 1 deletion utils/determine-os.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ elif [ -r /etc/redhat-release ] && [ "${ID}" = "rhel" ]; then
v="$(echo "${VERSION_ID}" | cut -d '.' -f 1)"
case "${v}" in
7|8|9)
echo "${ID}${v}"
if [ -f /etc/yum.repos.d/ubi.repo ]; then
echo "ubi${v}"
else
echo "${ID}${v}"
fi
;;
*)
echo "unknown OS: ${ID}:${v}" >&2
Expand Down

0 comments on commit c3dab63

Please sign in to comment.