diff --git a/.github/packaging/validate_build_output.sh b/.github/packaging/validate_build_output.sh index 200b1a188..64098811e 100755 --- a/.github/packaging/validate_build_output.sh +++ b/.github/packaging/validate_build_output.sh @@ -1,3 +1,18 @@ +#!/bin/bash + +set -ex + +# Function to get the OS version +get_rpm_os_version() { + if [[ -f /etc/centos-release ]]; then + cat /etc/centos-release | awk '{print $4}' + elif [[ -f /etc/oracle-release ]]; then + cat /etc/oracle-release | awk '{print $5}' + else + echo "Unknown" + fi +} + package_type=${1} # Since $HOME is set in GH_Actions as /github/home, pyenv fails to create virtualenvs. @@ -10,11 +25,24 @@ pyenv versions pyenv virtualenv ${PACKAGING_PYTHON_VERSION} packaging_env pyenv activate packaging_env -git clone -b v0.8.24 --depth=1 https://github.com/citusdata/tools.git tools +git clone -b v0.8.27 --depth=1 https://github.com/citusdata/tools.git tools python3 -m pip install -r tools/packaging_automation/requirements.txt + + +echo "Package type: ${package_type}" +echo "OS version: $(get_rpm_os_version)" + + # if os version is centos 7 or oracle linux 7, then remove urllib3 with pip uninstall and install urllib3<2.0.0 with pip install +if [[ ${package_type} == "rpm" && $(get_rpm_os_version) == 7* ]]; then + python3 -m pip uninstall -y urllib3 + python3 -m pip install 'urllib3<2' +fi + python3 -m tools.packaging_automation.validate_build_output --output_file output.log \ --ignore_file .github/packaging/packaging_ignore.yml \ --package_type ${package_type} pyenv deactivate # Set $HOME back to /github/home export HOME=${GITHUB_HOME} + +# Print the output to the console diff --git a/.github/workflows/packaging-test-pipelines.yml b/.github/workflows/packaging-test-pipelines.yml index aecf8876c..f2d568e4c 100644 --- a/.github/workflows/packaging-test-pipelines.yml +++ b/.github/workflows/packaging-test-pipelines.yml @@ -43,7 +43,7 @@ jobs: - oraclelinux-7 - oraclelinux-8 - centos-7 - - centos-8 + - almalinux-8 - almalinux-9 POSTGRES_VERSION: ${{ fromJson(needs.get_postgres_versions_from_file.outputs.pg_versions) }} @@ -73,8 +73,18 @@ jobs: - name: Make run: | + git config --global --add safe.directory ${GITHUB_WORKSPACE} make CFLAGS="-Wno-missing-braces" -sj$(cat /proc/cpuinfo | grep "core id" | wc -l) 2>&1 | tee -a output.log + # Check the exit code of the make command + make_exit_code=${PIPESTATUS[0]} + + # If the make command returned a non-zero exit code, exit with the same code + if [[ $make_exit_code -ne 0 ]]; then + echo "make command failed with exit code $make_exit_code" + exit $make_exit_code + fi + - name: Make install run: | make CFLAGS="-Wno-missing-braces" install 2>&1 | tee -a output.log @@ -141,9 +151,22 @@ jobs: make clean - name: Make + shell: bash run: | + set -e + git config --global --add safe.directory ${GITHUB_WORKSPACE} make -sj$(cat /proc/cpuinfo | grep "core id" | wc -l) 2>&1 | tee -a output.log + # Check the exit code of the make command + make_exit_code=${PIPESTATUS[0]} + + # If the make command returned a non-zero exit code, exit with the same code + if [[ $make_exit_code -ne 0 ]]; then + echo "make command failed with exit code $make_exit_code" + exit $make_exit_code + fi + + - name: Make install run: | make install 2>&1 | tee -a output.log