This is an automated email from the ASF dual-hosted git repository. leborchuk pushed a commit to branch REL_2_STABLE in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit a4eedafcf6d0a3394a3cd1dd959d687ccea66e95 Author: Dianjin Wang <[email protected]> AuthorDate: Fri Aug 28 16:05:31 2026 +0800 CI: adapt binary-swap-check to the versioned RPM package name The RPM Name now carries the major version (apache-cloudberry-db-incubating-<major>), so `rpm -ql apache-cloudberry-db-incubating` no longer finds the freshly installed package. In the current-RPM step that made INSTALLED_PG empty and the step failed before it could locate the install tree. Read the Name from the RPM being installed instead, which works for the versioned name and for the historical unversioned one the baseline still uses, and check the result in both steps. This workflow only exists on REL_2_STABLE, so two earlier fixes never reached it: - `rpm -qlp ... | grep -q` races with `set -o pipefail`: grep closes the pipe on the first match, rpm dies with SIGPIPE and the pipeline is reported as failed. Drop -q and redirect grep instead. - The OS major version was parsed with `[0-9]`, which truncates a double-digit VERSION_ID. Use `[0-9]+`. --- .github/workflows/binary-swap-check.yml | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/binary-swap-check.yml b/.github/workflows/binary-swap-check.yml index 282fc9af877..fb0abf42e81 100644 --- a/.github/workflows/binary-swap-check.yml +++ b/.github/workflows/binary-swap-check.yml @@ -244,14 +244,14 @@ jobs: echo "Building RPM with Version: ${SAFE_VERSION}" "${SRC_DIR}"/devops/build/packaging/rpm/build-rpm.sh --version "${SAFE_VERSION}" --release "1" - os_version=$(grep -oP '(?<=^VERSION_ID=")[0-9]' /etc/os-release) + os_version=$(grep -oP '(?<=^VERSION_ID=")[0-9]+' /etc/os-release) RPM_FILE="${HOME}"/rpmbuild/RPMS/x86_64/apache-cloudberry-db-incubating-"${SAFE_VERSION}"-"1".el"${os_version}".x86_64.rpm # Verify RPM echo "Verifying RPM..." rpm -qip "${RPM_FILE}" for binary in "bin/postgres" "bin/psql"; do - if ! rpm -qlp "${RPM_FILE}" | grep -q "${binary}$"; then + if ! rpm -qlp "${RPM_FILE}" | grep "${binary}$" >/dev/null 2>&1; then echo "::error::Critical binary '${binary}' not found in RPM" exit 1 fi @@ -388,14 +388,14 @@ jobs: SAFE_VERSION=$(echo "99.0.0" | tr '-' '_') "${SRC_DIR}"/devops/build/packaging/rpm/build-rpm.sh --version "${SAFE_VERSION}" --release "current" - os_version=$(grep -oP '(?<=^VERSION_ID=")[0-9]' /etc/os-release) + os_version=$(grep -oP '(?<=^VERSION_ID=")[0-9]+' /etc/os-release) RPM_FILE="${HOME}"/rpmbuild/RPMS/x86_64/apache-cloudberry-db-incubating-"${SAFE_VERSION}"-"current".el"${os_version}".x86_64.rpm # Verify RPM echo "Verifying RPM..." rpm -qip "${RPM_FILE}" for binary in "bin/postgres" "bin/psql"; do - if ! rpm -qlp "${RPM_FILE}" | grep -q "${binary}$"; then + if ! rpm -qlp "${RPM_FILE}" | grep "${binary}$" >/dev/null 2>&1; then echo "::error::Critical binary '${binary}' not found in RPM" exit 1 fi @@ -523,10 +523,15 @@ jobs: echo "Installing baseline RPM: ${BASELINE_RPM}" dnf install -y "${BASELINE_RPM}" - # Check installed location based on where bin/postgres ended up - INSTALLED_PG=$(rpm -ql apache-cloudberry-db-incubating | grep "bin/postgres$" | head -1) + # Check installed location based on where bin/postgres ended up. + # Ask the RPM for its own Name: the package name now carries the + # major version (apache-cloudberry-db-incubating-<major>), and the + # baseline may still use the historical unversioned name. + PKG_NAME=$(rpm -qp --queryformat '%{NAME}\n' "${BASELINE_RPM}") + echo "Querying installed package: ${PKG_NAME}" + INSTALLED_PG=$(rpm -ql "${PKG_NAME}" | grep "bin/postgres$" | head -1) if [ -z "$INSTALLED_PG" ]; then - echo "::error::Could not find bin/postgres in installed RPM" + echo "::error::Could not find bin/postgres in installed RPM (${PKG_NAME})" exit 1 fi @@ -580,8 +585,15 @@ jobs: dnf install -y "${CURRENT_RPM}" || dnf upgrade -y "${CURRENT_RPM}" - # Check installed location - INSTALLED_PG=$(rpm -ql apache-cloudberry-db-incubating | grep "bin/postgres$" | head -1) + # Check installed location (see the baseline step for why the + # package name is read from the RPM instead of hardcoded). + PKG_NAME=$(rpm -qp --queryformat '%{NAME}\n' "${CURRENT_RPM}") + echo "Querying installed package: ${PKG_NAME}" + INSTALLED_PG=$(rpm -ql "${PKG_NAME}" | grep "bin/postgres$" | head -1) + if [ -z "$INSTALLED_PG" ]; then + echo "::error::Could not find bin/postgres in installed RPM (${PKG_NAME})" + exit 1 + fi INSTALLED_DIR=$(dirname $(dirname "$INSTALLED_PG")) echo "Detected installation at: ${INSTALLED_DIR}" --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
