From 120046c15bb3076331cfadc5f77ca8e83c8d81f1 Mon Sep 17 00:00:00 2001 From: Ludovic <54670129+lbr38@users.noreply.github.com> Date: Tue, 16 Jul 2024 09:03:43 +0200 Subject: [PATCH] Maintain compatibility with el7 --- .github/workflows/build-rpm.yml | 175 ++++++++++++++++++++++++--- .github/workflows/packaging/rpm/spec | 2 +- .github/workflows/release.yml | 61 ++++++++-- 3 files changed, 206 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build-rpm.yml b/.github/workflows/build-rpm.yml index 31475cc..a42d2dd 100644 --- a/.github/workflows/build-rpm.yml +++ b/.github/workflows/build-rpm.yml @@ -8,11 +8,23 @@ on: branches: [ main ] jobs: - build-rpm: - name: Build rpm package + #------------------------------------------------------------------------------------------------------------------- + # + # el7 + # + #------------------------------------------------------------------------------------------------------------------- + + # Build rpm package for el7 + # Even it is build on CentOS7, package should be installable on RHEL7/8/9 based systems + build-rpm-el7: + name: Build rpm package (for el7) runs-on: ubuntu-latest + env: + # Force to use node16 (for actions/checkout@v3) + ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true container: - image: rockylinux:9.3 + image: centos:7 options: --user root steps: - name: Checkout @@ -21,10 +33,35 @@ jobs: - name: Get linupdate version run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV - - name: Install dependencies packages + - name: Install CentOS7 archive repositories run: | - yum update -y - yum install rpmdevtools rpmlint -y + rm /etc/yum.repos.d/* -f + + echo "[os] + name=os repo + baseurl=https://vault.centos.org/7.9.2009/os/x86_64/ + enabled=1 + gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7 + gpgcheck=1" > /etc/yum.repos.d/os.repo + + echo "[extras] + name=extras repo + baseurl=https://vault.centos.org/7.9.2009/extras/x86_64/ + enabled=1 + gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7 + gpgcheck=1" > /etc/yum.repos.d/extras.repo + + echo "[updates] + name=updates repo + baseurl=https://vault.centos.org/7.9.2009/updates/x86_64/ + enabled=1 + gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7 + gpgcheck=1" > /etc/yum.repos.d/updates.repo + + yum clean all + + - name: Install dependencies packages + run: yum install rpmdevtools rpmlint -y - name: Create build environment run: | @@ -56,28 +93,30 @@ jobs: run: | cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/rpm/spec $HOME/rpmbuild/SPECS/linupdate.spec sed -i "s/__VERSION__/${{ env.VERSION }}/g" $HOME/rpmbuild/SPECS/linupdate.spec + sed -i "s/__RELEASEVER__/el7/g" $HOME/rpmbuild/SPECS/linupdate.spec - name: Build package run: | cd $HOME/rpmbuild/SPECS rpmbuild --target noarch -bb --quiet linupdate.spec - mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-stable.noarch.rpm /tmp/linupdate-test-build-${{ env.VERSION }}.noarch.rpm + mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-el7.noarch.rpm /tmp/linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm - path: /tmp/linupdate-test-build-${{ env.VERSION }}.noarch.rpm + name: linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm + path: /tmp/linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm retention-days: 1 - # Try to install package on Fedora 37 - install-fedora: - name: Install on Fedora 37 + + # Try to install packages on latest Fedora + install-fedora-el7: + name: Install on latest Fedora needs: - build-rpm + build-rpm-el7 runs-on: ubuntu-latest container: - image: fedora:37 + image: fedora:latest options: --user root steps: - name: Checkout @@ -87,14 +126,112 @@ jobs: run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV # Download builded deb package artifact - - name: Download artifact + - name: Download el7 artifact uses: actions/download-artifact@v3 with: - name: linupdate-test-build-${{ env.VERSION }}.noarch.rpm + name: linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm - name: Install package run: | dnf update -y - yum clean all - yum --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}.noarch.rpm - \ No newline at end of file + dnf clean all + dnf --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}-el7.noarch.rpm + + + #------------------------------------------------------------------------------------------------------------------- + # + # el9 + # + #------------------------------------------------------------------------------------------------------------------- + + # Build rpm package for el9 + # build-rpm-el9: + # name: Build rpm package (for el9) + # runs-on: ubuntu-latest + # container: + # image: rockylinux:9.3 + # options: --user root + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + + # - name: Get linupdate version + # run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV + + # - name: Install dependencies packages + # run: | + # yum update -y + # yum install rpmdevtools rpmlint -y + + # - name: Create build environment + # run: | + # mkdir -p $HOME/rpmbuild/BUILD + # mkdir -p $HOME/rpmbuild/BUILDROOT + # mkdir -p $HOME/rpmbuild/RPMS + # mkdir -p $HOME/rpmbuild/SOURCES + # mkdir -p $HOME/rpmbuild/SPECS + # mkdir -p /etc/linupdate/modules + # mkdir -p /opt/linupdate + # mkdir -p /opt/linupdate/.src/ + # mkdir -p /opt/linupdate/mods-available/ + # mkdir -p /opt/linupdate/mods-enabled/ + # mkdir -p /opt/linupdate/agents-available/ + # mkdir -p /opt/linupdate/agents-enabled/ + # mkdir -p /opt/linupdate/service/ + # mkdir -p /lib/systemd/system/ + + # - name: Copy files to include in the build + # run: | + # cp -r ${GITHUB_WORKSPACE}/src/* /opt/linupdate/.src/ + # cp -r ${GITHUB_WORKSPACE}/mods-available/* /opt/linupdate/mods-available/ + # cp -r ${GITHUB_WORKSPACE}/service/* /opt/linupdate/service/ + # cp ${GITHUB_WORKSPACE}/linupdate /opt/linupdate/linupdate + # cp ${GITHUB_WORKSPACE}/version /opt/linupdate/version + # cp -r ${GITHUB_WORKSPACE}/service/linupdate.systemd.template /lib/systemd/system/linupdate.service + + # - name: Copy spec file + # run: | + # cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/rpm/spec $HOME/rpmbuild/SPECS/linupdate.spec + # sed -i "s/__VERSION__/${{ env.VERSION }}/g" $HOME/rpmbuild/SPECS/linupdate.spec + # sed -i "s/__RELEASEVER__/el9/g" $HOME/rpmbuild/SPECS/linupdate.spec + + # - name: Build package + # run: | + # cd $HOME/rpmbuild/SPECS + # rpmbuild --target noarch -bb --quiet linupdate.spec + # mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-el9.noarch.rpm /tmp/linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm + + # - name: Upload artifact + # uses: actions/upload-artifact@v3 + # with: + # name: linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm + # path: /tmp/linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm + # retention-days: 1 + + # # Try to install packages on latest Fedora + # install-fedora-el9: + # name: Install on latest Fedora + # needs: + # build-rpm-el9 + # runs-on: ubuntu-latest + # container: + # image: fedora:latest + # options: --user root + # steps: + # - name: Checkout + # uses: actions/checkout@v3 + + # - name: Get linupdate version + # run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV + + # # Download builded deb package artifact + # - name: Download el9 artifact + # uses: actions/download-artifact@v3 + # with: + # name: linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm + + # - name: Install package + # run: | + # dnf update -y + # dnf clean all + # dnf --nogpgcheck localinstall -y ./linupdate-test-build-${{ env.VERSION }}-el9.noarch.rpm diff --git a/.github/workflows/packaging/rpm/spec b/.github/workflows/packaging/rpm/spec index 1098ea7..5c99644 100644 --- a/.github/workflows/packaging/rpm/spec +++ b/.github/workflows/packaging/rpm/spec @@ -1,6 +1,6 @@ Name: linupdate Version: __VERSION__ -Release: stable +Release: __RELEASEVER__ Summary: Linupdate package updater - Repomanager client side agent BuildArch: noarch diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index afd7de4..30e1246 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,11 +66,23 @@ jobs: path: /tmp/linupdate_${{ env.VERSION }}_all.deb retention-days: 3 - build-rpm: - name: Build rpm package + + #------------------------------------------------------------------------------------------------------------------- + # + # el7 + # + #------------------------------------------------------------------------------------------------------------------- + + # Build rpm package for el7 + build-rpm-el7: + name: Build rpm package (for el7) runs-on: ubuntu-latest + env: + # Force to use node16 (for actions/checkout@v3) + ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true container: - image: rockylinux:9.3 + image: centos:7 options: --user root steps: - name: Checkout @@ -79,10 +91,35 @@ jobs: - name: Get linupdate version run: echo "VERSION=$(cat ${GITHUB_WORKSPACE}/version)" >> $GITHUB_ENV - - name: Install dependencies packages + - name: Install CentOS7 archive repositories run: | - yum update -y - yum install rpmdevtools rpmlint -y + rm /etc/yum.repos.d/* -f + + echo "[os] + name=os repo + baseurl=https://vault.centos.org/7.9.2009/os/x86_64/ + enabled=1 + gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7 + gpgcheck=1" > /etc/yum.repos.d/os.repo + + echo "[extras] + name=extras repo + baseurl=https://vault.centos.org/7.9.2009/extras/x86_64/ + enabled=1 + gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7 + gpgcheck=1" > /etc/yum.repos.d/extras.repo + + echo "[updates] + name=updates repo + baseurl=https://vault.centos.org/7.9.2009/updates/x86_64/ + enabled=1 + gpgkey=https://vault.centos.org/RPM-GPG-KEY-CentOS-7 + gpgcheck=1" > /etc/yum.repos.d/updates.repo + + yum clean all + + - name: Install dependencies packages + run: yum install rpmdevtools rpmlint -y - name: Create build environment run: | @@ -114,18 +151,19 @@ jobs: run: | cp ${GITHUB_WORKSPACE}/.github/workflows/packaging/rpm/spec $HOME/rpmbuild/SPECS/linupdate.spec sed -i "s/__VERSION__/${{ env.VERSION }}/g" $HOME/rpmbuild/SPECS/linupdate.spec + sed -i "s/__RELEASEVER__/el7/g" $HOME/rpmbuild/SPECS/linupdate.spec - name: Build package run: | cd $HOME/rpmbuild/SPECS rpmbuild --target noarch -bb --quiet linupdate.spec - mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-stable.noarch.rpm /tmp/linupdate-${{ env.VERSION }}.noarch.rpm + mv $HOME/rpmbuild/RPMS/noarch/linupdate-${{ env.VERSION }}-el7.noarch.rpm /tmp/linupdate-${{ env.VERSION }}-el7.noarch.rpm - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: linupdate-${{ env.VERSION }}.noarch.rpm - path: /tmp/linupdate-${{ env.VERSION }}.noarch.rpm + name: linupdate-${{ env.VERSION }}-el7.noarch.rpm + path: /tmp/linupdate-${{ env.VERSION }}-el7.noarch.rpm retention-days: 3 release: @@ -152,7 +190,7 @@ jobs: - name: Download rpm artifact uses: actions/download-artifact@v3 with: - name: linupdate-${{ env.VERSION }}.noarch.rpm + name: linupdate-${{ env.VERSION }}-el7.noarch.rpm path: ~/assets # Create a new release @@ -167,7 +205,6 @@ jobs: body: | **Changes**: - - Added compatibility for Oracle Linux OS (@Starbix #53) draft: false prerelease: false @@ -179,4 +216,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: release_id: ${{ steps.create_release.outputs.id }} - assets_path: ~/assets \ No newline at end of file + assets_path: ~/assets