From 3f0e1efb5acf7365f8a674d694c9d2a093569172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrkan=20=C4=B0ndibay?= Date: Mon, 24 Jul 2023 14:44:27 +0300 Subject: [PATCH] Fixes error surpressions in packaging pipelines (#7054) DESCRIPTION: PR description that will go into the change log, up to 78 characters There are 4 errors arised recently and I fixed them in this PR. Problems and fixes are as below: 1. When executing make step in packaging pipeline, if it gets error, we can not detect it since there are additional operations after make in one line. With this fix, now if an error occured after make execution, we can detect and see the step red and failed here, 2. Recently we started to get the error ` fatal: detected dubious ownership in repository at '/__w/citus/citus' ` as below https://github.com/citusdata/citus/actions/runs/5542692968/jobs/10117706723#step:7:9 There is a fix for that one as well. 3. fixed the requirements issue arised related to urllib3 library version 4. Getting errors with centos-8 docker image with the new postgres-dev packages. Now, changed centos-8 image with almalinux-8 and now it works --- .github/packaging/validate_build_output.sh | 30 ++++++++++++++++++- .../workflows/packaging-test-pipelines.yml | 25 +++++++++++++++- 2 files changed, 53 insertions(+), 2 deletions(-) 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