Skip to content

Commit

Permalink
Unify RPM repo creation workflows (#1269)
Browse files Browse the repository at this point in the history
Deduplicate RPM creation jobs, so that there isn't a copy-pasted one for each
CentOS/Alma version.
  • Loading branch information
TimoWilken authored Nov 7, 2023
1 parent 1fb4b0d commit 4fec7e5
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 120 deletions.
167 changes: 47 additions & 120 deletions .github/workflows/o2-full-deps.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# Create repositories with all O2 prerequisites plus aliBuild and push them
# upstream (e.g. to S3).
name: o2-full-deps release
name: Build o2-full-deps repositories

# Controls when the action will run. This workflow is triggered manually.
"on":
Expand All @@ -10,85 +10,39 @@ name: o2-full-deps release
permissions: {}

jobs:
rpm-el7:
rpm:
runs-on: ubuntu-latest
container: centos:7
env:
ALIBUILD_TAG: v1.14.5

steps:
# For rpms/*.spec
- uses: actions/checkout@v3

- name: Install prerequisites
run: |
set -x
yum install -y rpm-build scl-utils-build createrepo unzip git python3-setuptools
curl https://rclone.org/install.sh | bash
cat << EOF > /tmp/rclone.conf
${{ secrets.S3_RCLONE_CONFIG }}
EOF
- name: Build the EL7 RPM and create a yum repo
run: |
set -x
rpmbuild -ba rpms/o2-prereq.spec
git clone -b "$ALIBUILD_TAG" https://github.com/alisw/alibuild
pushd alibuild
perl -p -i -e "s/LAST_TAG/$ALIBUILD_TAG/g" alibuild_helpers/__init__.py
python3 setup.py bdist_rpm --requires python3,python3-requests,git,python3-PyYAML
cp dist/alibuild-*.noarch.rpm ~/rpmbuild/RPMS/x86_64/
popd
cd ~/rpmbuild/RPMS/x86_64/
createrepo .
rclone --config /tmp/rclone.conf --transfers=10 --progress --delete-before \
sync local:./ rpms3:alibuild-repo/RPMS/o2-full-deps_x86-64/
rpm-el8:
runs-on: ubuntu-latest
container: centos:8
env:
ALIBUILD_TAG: v1.14.5

steps:
# For rpms/*.spec
- uses: actions/checkout@v3

- name: Install prerequisites
run: |
set -x
sed -i.bak -e 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i.bak -e 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
find /etc/yum.repos.d -name "*.bak" -delete
yum clean all
yum update -y
yum install -y rpm-build scl-utils-build createrepo unzip git python3-setuptools python3
curl https://rclone.org/install.sh | bash
cat << EOF > /tmp/rclone.conf
${{ secrets.S3_RCLONE_CONFIG }}
EOF
- name: Build the EL8 RPM and create a yum repo
run: |
set -x
rpmbuild -ba rpms/o2-prereq-cc8.spec
git clone -b "$ALIBUILD_TAG" https://github.com/alisw/alibuild
pushd alibuild
perl -p -i -e "s/LAST_TAG/$ALIBUILD_TAG/g" alibuild_helpers/__init__.py
python3 setup.py bdist_rpm --requires python3,git,python3-pyyaml
cp dist/alibuild-*.noarch.rpm ~/rpmbuild/RPMS/x86_64/
popd
cd ~/rpmbuild/RPMS/x86_64/
createrepo .
ls -la
rclone --config /tmp/rclone.conf --transfers=10 --progress --delete-before \
sync local:./ rpms3:alibuild-repo/RPMS/o2-full-deps_el8.x86-64/
rpm-el9:
runs-on: ubuntu-latest
container: almalinux:9
strategy:
# Keep running jobs for other Ubuntu versions, even if one fails.
fail-fast: false
matrix:
# For every entry in el_version:, add an {el_version, container, alibuild_tag} entry to include:!
el_version:
- el7
- el8
- el9
- fedora

# The include: key extends the matrix specified above with extra variables.
include:
- el_version: el7
container: centos:7
alibuild_tag: v1.14.5
- el_version: el8
container: almalinux:8
alibuild_tag: v1.14.5
- el_version: el9
container: almalinux:9
alibuild_tag: v1.15.1
- el_version: fedora
container: fedora:33
alibuild_tag: v1.14.5

name: RPM (${{ matrix.el_version }})
container: ${{ matrix.container }}
env:
ALIBUILD_TAG: v1.15.1
ALIBUILD_TAG: ${{ matrix.alibuild_tag }}
DISTRO: ${{ matrix.el_version }}

steps:
# For rpms/*.spec
Expand All @@ -105,55 +59,27 @@ jobs:
${{ secrets.S3_RCLONE_CONFIG }}
EOF
- name: Build the EL9 RPM and create a yum repo
run: |
set -x
rpmbuild -ba rpms/o2-prereq-alma9.spec
git clone -b "$ALIBUILD_TAG" https://github.com/alisw/alibuild
pushd alibuild
python3 setup.py bdist_rpm --requires python3,git,python3-pyyaml,python3-requests,python3-distro
cp dist/alibuild-*.noarch.rpm ~/rpmbuild/RPMS/x86_64/
popd
cd ~/rpmbuild/RPMS/x86_64/
createrepo .
ls -la
rclone --config /tmp/rclone.conf --transfers=10 --progress --delete-before \
sync local:./ rpms3:alibuild-repo/RPMS/o2-full-deps_el9.x86-64/
rpm-fedora:
runs-on: ubuntu-latest
container: fedora:33
env:
ALIBUILD_TAG: v1.14.5

steps:
# For rpms/*.spec
- uses: actions/checkout@v3

- name: Install prerequisites
run: |
set -x
yum install -y rpm-build scl-utils-build createrepo unzip git python3-setuptools python3
curl https://rclone.org/install.sh | bash
cat << EOF > /tmp/rclone.conf
${{ secrets.S3_RCLONE_CONFIG }}
EOF
- name: Build the Fedora RPM and create a yum repo.
- name: Build the ${{ matrix.el_version }} RPM and create a yum repo
run: |
set -x
rpmbuild -ba --define '__python %__python3' rpms/o2-prereq-fedora.spec
rpmbuild -ba "rpms/o2-prereq-$DISTRO.spec"
git clone -b "$ALIBUILD_TAG" https://github.com/alisw/alibuild
pushd alibuild
perl -p -i -e "s/LAST_TAG/$ALIBUILD_TAG/g" alibuild_helpers/__init__.py
python3 setup.py bdist_rpm --requires python3,git,python3-pyyaml,python3-requests
cp dist/alibuild-*.noarch.rpm ~/rpmbuild/RPMS/x86_64/
popd
cd alibuild
case "$DISTRO" in
el7) deps=python3,git,python3-PyYAML,python3-requests,python3-distro ;;
*) deps=python3,git,python3-pyyaml,python3-requests,python3-distro ;;
esac
python3 setup.py bdist_rpm --requires "$deps"
cp dist/alibuild-*.noarch.rpm ~/rpmbuild/RPMS/x86_64/
cd ~/rpmbuild/RPMS/x86_64/
createrepo .
ls -la
case "$DISTRO" in
el7) repo_suffix= ;;
*) repo_suffix=_$DISTRO ;;
esac
rclone --config /tmp/rclone.conf --transfers=10 --progress --delete-before \
sync local:./ rpms3:alibuild-repo/RPMS/o2-full-deps_fedora.x86-64/
sync local:./ "rpms3:alibuild-repo/RPMS/o2-full-deps$repo_suffix.x86-64/"
deb-ubuntu:
runs-on: ubuntu-latest
Expand All @@ -166,6 +92,7 @@ jobs:
- focal # 20.04
- jammy # 22.04

name: DEB (${{ matrix.ubuntu_codename }})
container: ubuntu:${{ matrix.ubuntu_codename }}
env:
ALIBUILD_TAG: v1.14.5
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4fec7e5

Please sign in to comment.