From 25c106af5b156f389ea0ed558c34ed16151e444f Mon Sep 17 00:00:00 2001 From: Shreemaan Abhishek Date: Tue, 20 Aug 2024 09:33:04 +0545 Subject: [PATCH] chore: remove support for centos (#394) --- .github/workflows/publish.yml | 43 +++-------------------- Makefile | 4 +-- build-apisix-base-debug-centos7.sh | 19 ---------- build-apisix-runtime-debug-centos7.sh | 19 ---------- dockerfiles/Dockerfile.apisix-base.rpm | 14 ++------ dockerfiles/Dockerfile.apisix-runtime.rpm | 16 ++------- dockerfiles/Dockerfile.apisix.rpm | 16 ++------- dockerfiles/Dockerfile.dashboard.rpm | 15 ++------ utils/build-common.sh | 36 +++---------------- utils/determine-dist.sh | 6 +--- utils/publish-rpm.sh | 14 -------- 11 files changed, 20 insertions(+), 182 deletions(-) delete mode 100755 build-apisix-base-debug-centos7.sh delete mode 100755 build-apisix-runtime-debug-centos7.sh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 491522f47..acd960b4c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -73,8 +73,6 @@ jobs: source .requirements # build apisix - make package type=rpm app=apisix openresty=apisix-runtime runtime_version=${APISIX_RUNTIME} checkout=${APISIX_TAG_VERSION} version=${APISIX_TAG_VERSION} image_base=centos image_tag=7 - make package type=rpm app=apisix openresty=apisix-runtime runtime_version=${APISIX_RUNTIME} checkout=${APISIX_TAG_VERSION} version=${APISIX_TAG_VERSION} image_base=centos image_tag=8 make package type=rpm app=apisix openresty=apisix-runtime runtime_version=${APISIX_RUNTIME} checkout=${APISIX_TAG_VERSION} version=${APISIX_TAG_VERSION} image_base=registry.access.redhat.com/ubi8/ubi image_tag=8.6 mv ./output/apisix-${APISIX_TAG_VERSION}-0.{el7,el8,ubi8.6}.${ARCH}.rpm ${VAR_RPM_WORKBENCH_DIR} echo "TARGET_APP=apisix" >> "$GITHUB_ENV" @@ -86,8 +84,6 @@ jobs: run: | # build apisix-base echo ${{ env.TAG_TYPE }} ${{ env.TAG_VERSION }} - make package type=rpm app=apisix-base checkout=${APISIX_BASE_TAG_VERSION} version=${APISIX_BASE_TAG_VERSION} image_base=centos image_tag=7 - make package type=rpm app=apisix-base checkout=${APISIX_BASE_TAG_VERSION} version=${APISIX_BASE_TAG_VERSION} image_base=centos image_tag=8 make package type=rpm app=apisix-base checkout=${APISIX_BASE_TAG_VERSION} version=${APISIX_BASE_TAG_VERSION} image_base=registry.access.redhat.com/ubi8/ubi image_tag=8.6 mv ./output/apisix-base-${APISIX_BASE_TAG_VERSION}-0.{el7,el8,ubi8.6}.${ARCH}.rpm ${VAR_RPM_WORKBENCH_DIR} echo "TARGET_APP=apisix-base" >> "$GITHUB_ENV" @@ -99,8 +95,6 @@ jobs: run: | # build apisix-runtime echo ${{ env.TAG_TYPE }} ${{ env.TAG_VERSION }} - make package type=rpm app=apisix-runtime checkout=${APISIX_RUNTIME_TAG_VERSION} version=${APISIX_RUNTIME_TAG_VERSION} image_base=centos image_tag=7 - make package type=rpm app=apisix-runtime checkout=${APISIX_RUNTIME_TAG_VERSION} version=${APISIX_RUNTIME_TAG_VERSION} image_base=centos image_tag=8 make package type=rpm app=apisix-runtime checkout=${APISIX_RUNTIME_TAG_VERSION} version=${APISIX_RUNTIME_TAG_VERSION} image_base=registry.access.redhat.com/ubi8/ubi image_tag=8.6 mv ./output/apisix-runtime-${APISIX_RUNTIME_TAG_VERSION}-0.{el7,el8,ubi8.6}.${ARCH}.rpm ${VAR_RPM_WORKBENCH_DIR} echo "TARGET_APP=apisix-runtime" >> "$GITHUB_ENV" @@ -111,8 +105,6 @@ jobs: APISIX_DASHBOARD_TAG_VERSION: ${{ env.TAG_VERSION }} run: | # build apisix dashboard - make package type=rpm app=dashboard checkout=${APISIX_DASHBOARD_TAG_VERSION} version=${APISIX_DASHBOARD_TAG_VERSION} image_base=centos image_tag=7 - make package type=rpm app=dashboard checkout=${APISIX_DASHBOARD_TAG_VERSION} version=${APISIX_DASHBOARD_TAG_VERSION} image_base=centos image_tag=8 mv ./output/apisix-dashboard-${APISIX_DASHBOARD_TAG_VERSION}-0.el{7,8}.${ARCH}.rpm ${VAR_RPM_WORKBENCH_DIR} echo "TARGET_APP=apisix-dashboard" >> "$GITHUB_ENV" @@ -130,15 +122,6 @@ jobs: name: "${{ env.PACKAGE_NAME }}" path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${{ env.PACKAGE_NAME }}" - - name: Upload apisix Artifact for Centos - if: ${{ env.TAG_TYPE == 'apisix' }} - uses: actions/upload-artifact@v4.0.0 - env: - PACKAGE_NAME: apisix-${{ env.TAG_VERSION }}-0.el7.${{ env.ARCH }}.rpm - with: - name: "${{ env.PACKAGE_NAME }}" - path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${{ env.PACKAGE_NAME }}" - - name: Upload apisix-base Artifact for Redhat if: ${{ env.TAG_TYPE == 'apisix-base' }} uses: actions/upload-artifact@v4.0.0 @@ -148,15 +131,6 @@ jobs: name: "${{ env.PACKAGE_NAME }}" path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${{ env.PACKAGE_NAME }}" - - name: Upload apisix-base Artifact for Centos - if: ${{ env.TAG_TYPE == 'apisix-base' }} - uses: actions/upload-artifact@v4.0.0 - env: - PACKAGE_NAME: apisix-base-${{ env.TAG_VERSION }}-0.el7.${{ env.ARCH }}.rpm - with: - name: "${{ env.PACKAGE_NAME }}" - path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${{ env.PACKAGE_NAME }}" - - name: Upload apisix-runtime Artifact for Redhat if: ${{ env.TAG_TYPE == 'apisix-runtime' }} uses: actions/upload-artifact@v4.0.0 @@ -166,15 +140,6 @@ jobs: name: "${{ env.PACKAGE_NAME }}" path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${{ env.PACKAGE_NAME }}" - - name: Upload apisix-runtime Artifact for Centos - if: ${{ env.TAG_TYPE == 'apisix-runtime' }} - uses: actions/upload-artifact@v4.0.0 - env: - PACKAGE_NAME: apisix-runtime-${{ env.TAG_VERSION }}-0.el7.${{ env.ARCH }}.rpm - with: - name: "${{ env.PACKAGE_NAME }}" - path: "${{ env.VAR_RPM_WORKBENCH_DIR }}/${{ env.PACKAGE_NAME }}" - - name: Upload apisix-dashboard Artifact if: ${{ env.TAG_TYPE == 'dashboard' }} uses: actions/upload-artifact@v4.0.0 @@ -192,7 +157,7 @@ jobs: sudo pip install coscmd sudo -E ./utils/publish-rpm.sh init_cos_utils - - name: RPM repo init for centos and redhat + - name: RPM repo init for redhat run: | sudo -E ./utils/publish-rpm.sh repo_init sudo -E ./utils/publish-rpm.sh repo_clone @@ -208,15 +173,15 @@ jobs: sudo -E ./utils/publish-rpm.sh rpm_gpg_sign sudo -E ./utils/publish-rpm.sh repo_package_sync - - name: RPM repo backup for centos and redhat + - name: RPM repo backup for redhat run: | sudo -E ./utils/publish-rpm.sh repo_backup - - name: RPM repo refresh for centos and redhat + - name: RPM repo refresh for redhat run: | sudo -E ./utils/publish-rpm.sh repo_repodata_rebuild sudo -E ./utils/publish-rpm.sh repo_upload - - name: RPM repo publish for centos and redhat + - name: RPM repo publish for redhat run: | sudo -E ./utils/publish-rpm.sh repo_publish diff --git a/Makefile b/Makefile index a9740f4c7..ac2481012 100644 --- a/Makefile +++ b/Makefile @@ -19,8 +19,8 @@ version=0 checkout=0 app=0 type=0 -image_base="centos" -image_tag="7" +image_base="registry.access.redhat.com/ubi8/ubi" +image_tag="8.6" iteration=0 local_code_path=0 openresty="apisix-runtime" diff --git a/build-apisix-base-debug-centos7.sh b/build-apisix-base-debug-centos7.sh deleted file mode 100755 index 26f2289bd..000000000 --- a/build-apisix-base-debug-centos7.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -set -x - -yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo -yum -y install gcc gcc-c++ patch wget git make sudo -yum -y install openresty-openssl111-debug-devel openresty-pcre-devel openresty-zlib-devel - -export openssl_prefix=/usr/local/openresty-debug/openssl111 -export zlib_prefix=/usr/local/openresty/zlib -export pcre_prefix=/usr/local/openresty/pcre - -export cc_opt="-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC -I${zlib_prefix}/include -I${pcre_prefix}/include -I${openssl_prefix}/include -O0" -export ld_opt="-L${zlib_prefix}/lib -L${pcre_prefix}/lib -L${openssl_prefix}/lib -Wl,-rpath,${zlib_prefix}/lib:${pcre_prefix}/lib:${openssl_prefix}/lib" -export luajit_xcflags="-DLUAJIT_ASSERT -DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT -O0" -export OR_PREFIX=/usr/local/openresty-debug -export debug_args=--with-debug - -./build-apisix-base.sh diff --git a/build-apisix-runtime-debug-centos7.sh b/build-apisix-runtime-debug-centos7.sh deleted file mode 100755 index 3dbb053fa..000000000 --- a/build-apisix-runtime-debug-centos7.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -set -x - -yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo -yum -y install gcc gcc-c++ patch wget git make sudo -yum -y install openresty-pcre-devel openresty-zlib-devel - -export openssl_prefix=/usr/local/openresty/openssl3 -export zlib_prefix=/usr/local/openresty/zlib -export pcre_prefix=/usr/local/openresty/pcre - -export cc_opt="-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC -I${zlib_prefix}/include -I${pcre_prefix}/include -I${openssl_prefix}/include -O0" -export ld_opt="-L${zlib_prefix}/lib -L${pcre_prefix}/lib -L${openssl_prefix}/lib -Wl,-rpath,${zlib_prefix}/lib:${pcre_prefix}/lib:${openssl_prefix}/lib" -export luajit_xcflags="-DLUAJIT_ASSERT -DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT -O0" -export OR_PREFIX=/usr/local/openresty -export debug_args=--with-debug - -./build-apisix-runtime.sh latest diff --git a/dockerfiles/Dockerfile.apisix-base.rpm b/dockerfiles/Dockerfile.apisix-base.rpm index 6981c018a..c03be0472 100644 --- a/dockerfiles/Dockerfile.apisix-base.rpm +++ b/dockerfiles/Dockerfile.apisix-base.rpm @@ -1,18 +1,8 @@ -ARG IMAGE_BASE="centos" -ARG IMAGE_TAG="7" +ARG IMAGE_BASE="registry.access.redhat.com/ubi8/ubi" +ARG IMAGE_TAG="8.6" FROM ${IMAGE_BASE}:${IMAGE_TAG} -# Note: The duplication around the rpm series dockerfile here -# is used for reuse the container layer cache -RUN if [[ $(rpm --eval '%{centos_ver}') == "8" ]]; then \ - sed -re "s/^#?\s*(mirrorlist)/#\1/g" \ - -e "s|^#?\s*baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" \ - -i /etc/yum.repos.d/CentOS-Linux-*; \ - dnf install -y centos-release-stream; \ - dnf swap -y centos-{linux,stream}-repos; \ - dnf distro-sync -y; \ - fi COPY ./utils/build-common.sh /tmp/build-common.sh COPY build-apisix-base.sh /tmp/build-apisix-base.sh diff --git a/dockerfiles/Dockerfile.apisix-runtime.rpm b/dockerfiles/Dockerfile.apisix-runtime.rpm index 65a9e5e33..9f82841fa 100644 --- a/dockerfiles/Dockerfile.apisix-runtime.rpm +++ b/dockerfiles/Dockerfile.apisix-runtime.rpm @@ -1,20 +1,8 @@ -ARG IMAGE_BASE="centos" -ARG IMAGE_TAG="7" +ARG IMAGE_BASE="registry.access.redhat.com/ubi8/ubi" +ARG IMAGE_TAG="8.6" FROM ${IMAGE_BASE}:${IMAGE_TAG} -# Note: The duplication around the rpm series dockerfile here -# is used for reuse the container layer cache -RUN if [[ $(rpm --eval '%{centos_ver}') == "8" ]]; then \ - sed -re "s/^#?\s*(mirrorlist)/#\1/g" \ - -e "s|^#?\s*baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" \ - -i /etc/yum.repos.d/CentOS-Linux-*; \ - dnf install -y centos-release-stream; \ - dnf swap -y centos-{linux,stream}-repos; \ - dnf distro-sync -y; \ - fi - - WORKDIR /tmp ARG VERSION diff --git a/dockerfiles/Dockerfile.apisix.rpm b/dockerfiles/Dockerfile.apisix.rpm index 4697a98d0..b31cdea6e 100644 --- a/dockerfiles/Dockerfile.apisix.rpm +++ b/dockerfiles/Dockerfile.apisix.rpm @@ -1,22 +1,12 @@ -ARG IMAGE_BASE="centos" -ARG IMAGE_TAG="7" +ARG IMAGE_BASE="registry.access.redhat.com/ubi8/ubi" +ARG IMAGE_TAG="8.6" + ARG PACKAGE_TYPE ARG RUNTIME_VERSION FROM apache/apisix-runtime-${PACKAGE_TYPE}:${RUNTIME_VERSION} AS APISIX-RUNTIME FROM ${IMAGE_BASE}:${IMAGE_TAG} -# Note: The duplication around the rpm series dockerfile here -# is used for reuse the container layer cache -RUN if [[ $(rpm --eval '%{centos_ver}') == "8" ]]; then \ - sed -re "s/^#?\s*(mirrorlist)/#\1/g" \ - -e "s|^#?\s*baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" \ - -i /etc/yum.repos.d/CentOS-Linux-*; \ - dnf install -y centos-release-stream; \ - dnf swap -y centos-{linux,stream}-repos; \ - dnf distro-sync -y; \ - fi - COPY ./utils/install-common.sh /install-common.sh COPY ./utils/determine-dist.sh /determine-dist.sh COPY --from=APISIX-RUNTIME /usr/local/openresty /usr/local/openresty diff --git a/dockerfiles/Dockerfile.dashboard.rpm b/dockerfiles/Dockerfile.dashboard.rpm index c82add2a2..30620286f 100644 --- a/dockerfiles/Dockerfile.dashboard.rpm +++ b/dockerfiles/Dockerfile.dashboard.rpm @@ -1,19 +1,8 @@ -ARG IMAGE_BASE="centos" -ARG IMAGE_TAG="7" +ARG IMAGE_BASE="registry.access.redhat.com/ubi8/ubi" +ARG IMAGE_TAG="8.6" FROM ${IMAGE_BASE}:${IMAGE_TAG} -# Note: The duplication around the rpm series dockerfile here -# is used for reuse the container layer cache -RUN if [[ $(rpm --eval '%{centos_ver}') == "8" ]]; then \ - sed -re "s/^#?\s*(mirrorlist)/#\1/g" \ - -e "s|^#?\s*baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" \ - -i /etc/yum.repos.d/CentOS-Linux-*; \ - dnf install -y centos-release-stream; \ - dnf swap -y centos-{linux,stream}-repos; \ - dnf distro-sync -y; \ - fi - COPY ./utils/install-common.sh /install-common.sh COPY ./utils/determine-dist.sh /determine-dist.sh diff --git a/utils/build-common.sh b/utils/build-common.sh index affeccbcc..989799301 100755 --- a/utils/build-common.sh +++ b/utils/build-common.sh @@ -6,22 +6,8 @@ ARCH=${ARCH:-`(uname -m | tr '[:upper:]' '[:lower:]')`} BUILD_PATH=${BUILD_PATH:-`pwd`} build_apisix_base_rpm() { - if [[ $(rpm --eval '%{centos_ver}') == "7" ]]; then - yum -y install centos-release-scl - yum -y install devtoolset-9 patch wget git make sudo - set +eu - source scl_source enable devtoolset-9 - set -eu - elif [[ $(rpm --eval '%{centos_ver}') == "8" ]]; then - dnf install -y gcc-toolset-9-toolchain patch wget git make sudo - dnf install -y yum-utils - set +eu - source /opt/rh/gcc-toolset-9/enable - set -eu - else - dnf install -y yum-utils - yum -y install --disablerepo=* --enablerepo=ubi-8-appstream-rpms --enablerepo=ubi-8-baseos-rpms gcc gcc-c++ patch wget git make sudo xz - fi + dnf install -y yum-utils + yum -y install --disablerepo=* --enablerepo=ubi-8-appstream-rpms --enablerepo=ubi-8-baseos-rpms gcc gcc-c++ patch wget git make sudo xz command -v gcc gcc --version @@ -69,22 +55,8 @@ build_apisix_base_apk() { } build_apisix_runtime_rpm() { - if [[ $(rpm --eval '%{centos_ver}') == "7" ]]; then - yum -y install centos-release-scl - yum -y install devtoolset-9 patch wget git make sudo cpanminus - set +eu - source scl_source enable devtoolset-9 - set -eu - elif [[ $(rpm --eval '%{centos_ver}') == "8" ]]; then - dnf install -y gcc-toolset-9-toolchain patch wget git make sudo cpanminus - dnf install -y yum-utils - set +eu - source /opt/rh/gcc-toolset-9/enable - set -eu - else - dnf install -y yum-utils - yum -y install --disablerepo=* --enablerepo=ubi-8-appstream-rpms --enablerepo=ubi-8-baseos-rpms gcc gcc-c++ patch wget git make sudo xz cpanminus - fi + dnf install -y yum-utils + yum -y install --disablerepo=* --enablerepo=ubi-8-appstream-rpms --enablerepo=ubi-8-baseos-rpms gcc gcc-c++ patch wget git make sudo xz cpanminus command -v gcc gcc --version diff --git a/utils/determine-dist.sh b/utils/determine-dist.sh index 8d0b4f960..400340236 100755 --- a/utils/determine-dist.sh +++ b/utils/determine-dist.sh @@ -2,11 +2,7 @@ set -euo pipefail set -x -dist="el7" -if [ "${IMAGE_BASE}" == "centos" ] -then - dist="el${IMAGE_TAG}" -elif [ "${IMAGE_BASE}" == "ubuntu" ] +if [ "${IMAGE_BASE}" == "ubuntu" ] then dist="${IMAGE_BASE}${IMAGE_TAG}" elif [ "${IMAGE_BASE}" == "debian" ] diff --git a/utils/publish-rpm.sh b/utils/publish-rpm.sh index e530bbe30..9511c2669 100755 --- a/utils/publish-rpm.sh +++ b/utils/publish-rpm.sh @@ -59,7 +59,6 @@ func_cos_utils_credential_init() { # ======================================= func_repo_init() { # ${1} - repo workbench path - mkdir -p "${1}"/centos/{7,8}/${ARCH} mkdir -p "${1}"/redhat/8/${ARCH} } @@ -135,20 +134,12 @@ repo_init) func_repo_init /tmp ;; repo_backup) - func_repo_backup "${VAR_COS_BUCKET_REPO}" "centos" "${TAG_DATE}" func_repo_backup "${VAR_COS_BUCKET_REPO}" "redhat" "${TAG_DATE}" ;; repo_clone) - func_repo_clone "${VAR_COS_BUCKET_REPO}" "centos" /tmp/centos func_repo_clone "${VAR_COS_BUCKET_REPO}" "redhat" /tmp/redhat ;; repo_package_sync) - VAR_REPO_MAJOR_VER=(7 8) - for i in "${VAR_REPO_MAJOR_VER[@]}"; do - find "${VAR_RPM_WORKBENCH_DIR}" -type f -name "*el${i}.${ARCH}.rpm" \ - -exec echo "repo sync for: {}" \; \ - -exec cp -a {} /tmp/centos/"${i}"/${ARCH} \; - done find "${VAR_RPM_WORKBENCH_DIR}" -type f -name "*ubi8.6.${ARCH}.rpm" \ -exec echo "repo sync for: {}" \; \ -exec cp -a {} /tmp/redhat/8/${ARCH} \; @@ -156,20 +147,15 @@ repo_package_sync) repo_repodata_rebuild) func_repo_repodata_rebuild /tmp/redhat func_repo_repodata_sign /tmp/redhat - func_repo_repodata_rebuild /tmp/centos - func_repo_repodata_sign /tmp/centos ;; repo_upload) func_repo_upload /tmp/redhat "${VAR_COS_BUCKET_CI}" "redhat" - func_repo_upload /tmp/centos "${VAR_COS_BUCKET_CI}" "centos" ;; repo_publish) func_repo_publish "${VAR_COS_BUCKET_CI}" "${VAR_COS_BUCKET_REPO}" "redhat" - func_repo_publish "${VAR_COS_BUCKET_CI}" "${VAR_COS_BUCKET_REPO}" "centos" ;; repo_backup_remove) func_repo_backup_remove "${VAR_COS_BUCKET_REPO}" "redhat" "${TAG_DATE}" - func_repo_backup_remove "${VAR_COS_BUCKET_REPO}" "centos" "${TAG_DATE}" ;; rpm_gpg_sign) func_rpmsign_macros_init