From 4bc7044710f1d60658d19e5dd400eff0cfa44941 Mon Sep 17 00:00:00 2001 From: Rene Cannao Date: Mon, 27 Apr 2026 04:33:17 +0000 Subject: [PATCH] ci(docker): install libprotobuf-dev on demand when PROXYSQLGENAI=1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI-builds (ubuntu24,-tap-genai-gcov) was failing on PR #5651 because the proxysql/packaging:build-ubuntu24-v4.0.0 image lacks libprotobuf-dev. The plugin Makefile's pkg-config check at plugins/mysqlx/Makefile:47 fires correctly: protobuf 3.x is required for the vendored .pb.cc/.pb.h that were generated with protoc 3.21.12. The v4.0.0 packaging images were built in anticipation of this PR but never updated to include the new dependency. Two paths to resolve. (a) Update the image and republish proxysql/packaging:build-ubuntu24-v4.0.0 + cousins. (b) Patch the docker-compose entrypoint to install on demand. (a) is the cleaner long-term fix but has a longer feedback loop (separate pipeline, separate review). (b) unblocks CI immediately and keeps working even if a future image rebuild forgets the package again. This commit takes path (b) for all three image families: - docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash → apt-get install -y libprotobuf-dev (Debian, Ubuntu) - docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash → dnf|yum install -y protobuf-devel (CentOS, RHEL) - docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash → zypper install -y libprotobuf-c-devel || protobuf-devel (SUSE) The install is gated on PROXYSQLGENAI=1 (otherwise the plugin path is not exercised) AND on pkg-config --exists protobuf returning false (image already has it → install is a no-op). Idempotent across container restarts. Once the v4.0.0 packaging images are republished with libprotobuf-dev included, this on-demand install becomes a no-op pkg-config check on every build and can be removed. Tracked in issue #5673. Verified locally: the deb-compliant patch follows the existing entrypoint control-flow exactly (set -eu safe, no early exit, runs before the ${MAKE} ${deps_target} call where the protobuf check would fire). --- .../deb-compliant/entrypoint/entrypoint.bash | 16 ++++++++++++++++ .../rhel-compliant/entrypoint/entrypoint.bash | 19 +++++++++++++++++++ .../suse-compliant/entrypoint/entrypoint.bash | 17 +++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash b/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash index 4d8329e3c..3cde22c0a 100755 --- a/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash +++ b/docker/images/proxysql/deb-compliant/entrypoint/entrypoint.bash @@ -41,6 +41,22 @@ else build_target="$PROXYSQL_BUILD_TYPE" fi +# When PROXYSQLGENAI=1 is set, the build recurses into plugins/mysqlx/ +# which dynamically links against the system libprotobuf (3.x). Some of +# the v4.0.0 packaging images were built before plugins/mysqlx existed +# and do not yet ship libprotobuf-dev. Install it on demand here so the +# plugin's pkg-config check at plugins/mysqlx/Makefile:47 succeeds. The +# install is idempotent — apt-get returns 0 if the package is already +# present. Skip silently for v3.x builds where PROXYSQLGENAI is unset +# and the plugin path is not exercised. +if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then + if ! pkg-config --exists protobuf 2>/dev/null; then + echo "==> Installing libprotobuf-dev (required for PROXYSQLGENAI=1 mysqlx plugin build)" + apt-get update -qq + apt-get install -y --no-install-recommends libprotobuf-dev + fi +fi + # clean is expensive, do it before, outside of container #${MAKE} cleanbuild if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then diff --git a/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash b/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash index 88d33e304..a6997070f 100755 --- a/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash +++ b/docker/images/proxysql/rhel-compliant/entrypoint/entrypoint.bash @@ -41,6 +41,25 @@ else build_target="$PROXYSQL_BUILD_TYPE" fi +# See deb-compliant entrypoint for the rationale: PROXYSQLGENAI=1 +# triggers a build of plugins/mysqlx/ which dynamically links against +# the system libprotobuf (3.x). Some of the v4.0.0 packaging images +# were built before plugins/mysqlx existed and do not yet ship +# protobuf-devel. Install it on demand for RHEL-family images. +if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then + if ! pkg-config --exists protobuf 2>/dev/null; then + echo "==> Installing protobuf-devel (required for PROXYSQLGENAI=1 mysqlx plugin build)" + if command -v dnf >/dev/null 2>&1; then + dnf install -y protobuf-devel + elif command -v yum >/dev/null 2>&1; then + yum install -y protobuf-devel + else + echo "ERROR: cannot install protobuf-devel (neither dnf nor yum present)" >&2 + exit 1 + fi + fi +fi + # clean is expensive, do it before, outside of container #${MAKE} cleanbuild if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then diff --git a/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash b/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash index 2eff69862..1b1e97d1f 100755 --- a/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash +++ b/docker/images/proxysql/suse-compliant/entrypoint/entrypoint.bash @@ -41,6 +41,23 @@ else build_target="$PROXYSQL_BUILD_TYPE" fi +# See deb-compliant entrypoint for the rationale: PROXYSQLGENAI=1 +# triggers a build of plugins/mysqlx/ which dynamically links against +# the system libprotobuf (3.x). Some of the v4.0.0 packaging images +# were built before plugins/mysqlx existed and do not yet ship +# protobuf-devel. Install it on demand for SUSE-family images. +if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then + if ! pkg-config --exists protobuf 2>/dev/null; then + echo "==> Installing protobuf-devel (required for PROXYSQLGENAI=1 mysqlx plugin build)" + if command -v zypper >/dev/null 2>&1; then + zypper install -y libprotobuf-c-devel || zypper install -y protobuf-devel + else + echo "ERROR: cannot install protobuf-devel (zypper not present)" >&2 + exit 1 + fi + fi +fi + # clean is expensive, do it before, outside of container #${MAKE} cleanbuild if [[ "${PROXYSQLGENAI:-}" == "1" ]]; then