Skip to content

SRE-2452 rpms: Script to build RPMs from scratch #45

SRE-2452 rpms: Script to build RPMs from scratch

SRE-2452 rpms: Script to build RPMs from scratch #45

name: RPM Build Script Test
on:
pull_request:
permissions: {}
jobs:
Run_in_docker:
runs-on: ubuntu-latest
strategy:
matrix:
os: ["rockylinux:8.6",
"rockylinux:8.8",
"rockylinux:8.10",
"rockylinux:9.2",
"rockylinux:9.3",
"opensuse/leap:15.4",
"opensuse/leap:15.5",
"opensuse/leap:15.6"]
platform: ["amd64"]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run Shell Script in Docker
run: |
distro="${{ matrix.os }}"
distro_clean="${distro//[:\/]/_}"
rpm_dst=~/rpms/$distro_clean
check_docker_image_exists() {
local image=$1
if docker manifest inspect "$image" > /dev/null 2>&1; then
return 0 # Image exists
else
return 1 # Image does not exist
fi
}
mkdir -p "$rpm_dst"
chmod 777 "$rpm_dst"
# Check if the Docker image exists before running it
if check_docker_image_exists "$distro"; then
docker run --rm -v "$rpm_dst":/root/rpms -v .:/daos $distro \
/daos/utils/build_rpms_from_scratch.sh /root/rpms
else
echo "Warning: Docker image '$distro' does not exist. Skipping this step."
fi