From bb0bff084ee8161f29020a4df2f838430e7db10b Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Wed, 8 Jul 2026 14:18:22 -0700 Subject: [PATCH 01/39] feat(packaging): Add a manylinux-based build-env image and CI to publish it. --- .github/workflows/build-dependency-image.yaml | 131 ++++++++++++++++++ taskfile.yaml | 2 +- taskfiles/velox-connector/deps.yaml | 1 - .../build-packages/build-dependency-image.sh | 82 +++++++++++ .../dependency-image/Dockerfile | 52 +++++++ tools/build-packages/dependency-image/lib.sh | 89 ++++++++++++ tools/ca-bundle/ca-bundle.sh | 36 +++++ tools/ca-bundle/install-ca-bundle.sh | 18 +++ tools/ca-bundle/stage-ca-bundle.sh | 15 ++ 9 files changed, 424 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-dependency-image.yaml create mode 100755 tools/build-packages/build-dependency-image.sh create mode 100644 tools/build-packages/dependency-image/Dockerfile create mode 100644 tools/build-packages/dependency-image/lib.sh create mode 100644 tools/ca-bundle/ca-bundle.sh create mode 100755 tools/ca-bundle/install-ca-bundle.sh create mode 100755 tools/ca-bundle/stage-ca-bundle.sh diff --git a/.github/workflows/build-dependency-image.yaml b/.github/workflows/build-dependency-image.yaml new file mode 100644 index 00000000..ee1b89f9 --- /dev/null +++ b/.github/workflows/build-dependency-image.yaml @@ -0,0 +1,131 @@ +# Publishes the content-addressed build-env image used by package builds. +# +# Flow: +# plan derive the env- image reference and check GHCR +# build publish per-architecture images when the tag is missing +# manifest publish the multi-architecture env- tag + +name: "build-dependency-image" + +on: + workflow_call: + outputs: + image: + description: "Fully qualified dependency image reference" + value: "${{jobs.plan.outputs.image}}" + workflow_dispatch: + +concurrency: + # Keep direct and reusable-workflow invocations in the same concurrency group. + group: "build-dependency-image-${{github.ref}}" + cancel-in-progress: true + +env: + IMAGE_NAME: "build-env" + +jobs: + plan: + runs-on: "ubuntu-24.04" + permissions: + contents: "read" + packages: "read" + outputs: + image: "${{steps.image.outputs.ref}}" + needs-build: "${{steps.decide.outputs.needs-build}}" + steps: + - name: "Check out repository" + uses: "actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5" # v4.3.1 + + - name: "Resolve dependency image" + id: "image" + run: |- + source tools/build-packages/dependency-image/lib.sh + build_env_hash=$(derive_build_env_hash) + image_repo="ghcr.io/$(printf '%s' "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')" + image=$(image_ref "${image_repo}" "${IMAGE_NAME}" "${build_env_hash}") + echo "ref=${image}" >> "$GITHUB_OUTPUT" + + - name: "Log in to GHCR" + uses: "docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9" # v3.7.0 + with: + registry: "ghcr.io" + username: "${{github.actor}}" + password: "${{secrets.GITHUB_TOKEN}}" + + - name: "Decide whether to rebuild" + id: "decide" + env: + IMAGE: "${{steps.image.outputs.ref}}" + run: |- + if docker buildx imagetools inspect "${IMAGE}" &>/dev/null; then + echo "::notice::${IMAGE} already exists — skipping rebuild" + needs_build=false + else + echo "::notice::${IMAGE} not found — will build" + needs_build=true + fi + echo "needs-build=${needs_build}" >> "$GITHUB_OUTPUT" + + build: + needs: "plan" + if: "needs.plan.outputs.needs-build == 'true'" + permissions: + contents: "read" + packages: "write" + strategy: + fail-fast: false + matrix: + include: + - arch: "amd64" + runner: "ubuntu-24.04" + - arch: "arm64" + runner: "ubuntu-24.04-arm" + runs-on: "${{matrix.runner}}" + timeout-minutes: 360 + + steps: + - name: "Check out repository" + uses: "actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5" # v4.3.1 + + - name: "Log in to GHCR" + uses: "docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9" # v3.7.0 + with: + registry: "ghcr.io" + username: "${{github.actor}}" + password: "${{secrets.GITHUB_TOKEN}}" + + - name: "Set up Docker Buildx" + uses: "docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f" # v3.12.0 + + - name: "Build and push per-arch dependency image" + env: + IMAGE: "${{needs.plan.outputs.image}}" + ARCH: "${{matrix.arch}}" + run: |- + source tools/build-packages/dependency-image/lib.sh + build_image "${IMAGE}-${ARCH}" "linux/${ARCH}" "--push" + + manifest: + needs: ["plan", "build"] + if: "needs.plan.outputs.needs-build == 'true'" + permissions: + packages: "write" + runs-on: "ubuntu-24.04" + timeout-minutes: 15 + + steps: + - name: "Log in to GHCR" + uses: "docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9" # v3.7.0 + with: + registry: "ghcr.io" + username: "${{github.actor}}" + password: "${{secrets.GITHUB_TOKEN}}" + + - name: "Create multi-arch manifest" + env: + IMAGE: "${{needs.plan.outputs.image}}" + run: |- + docker buildx imagetools create \ + --tag "${IMAGE}" \ + "${IMAGE}-amd64" \ + "${IMAGE}-arm64" diff --git a/taskfile.yaml b/taskfile.yaml index 96705498..ca323e2e 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -6,7 +6,7 @@ includes: velox-connector: "taskfiles/velox-connector/main.yaml" vars: - G_BUILD_DIR: "{{.ROOT_DIR}}/build" + G_BUILD_DIR: '{{.CLP_PLUGIN_BUILD_DIR | default (printf "%s/build" .ROOT_DIR)}}' tasks: clean: diff --git a/taskfiles/velox-connector/deps.yaml b/taskfiles/velox-connector/deps.yaml index 438fdd51..6b2985bf 100644 --- a/taskfiles/velox-connector/deps.yaml +++ b/taskfiles/velox-connector/deps.yaml @@ -124,7 +124,6 @@ tasks: - task: "yscope-dev-utils:cmake:build" vars: BUILD_DIR: "{{.BUILD_DIR}}" - JOBS: "{{.G_CPP_MAX_PARALLELISM_PER_BUILD_TASK}}" - task: "yscope-dev-utils:cmake:install" vars: BUILD_DIR: "{{.BUILD_DIR}}" diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh new file mode 100755 index 00000000..18d78335 --- /dev/null +++ b/tools/build-packages/build-dependency-image.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +# Resolves this repo's dependency-image reference for local builds. +# Checks local Docker first, then GHCR, then builds a host-arch image. +# +# Prints the resolved image reference to stdout. +# +# Example: +# image=$(tools/build-packages/build-dependency-image.sh) +# docker run --rm -v "$(pwd):/src" -w /src "${image}" \ +# task velox-connector:build +# +# Requires: docker (with buildx), git, sha256sum. + +set -o errexit +set -o nounset +set -o pipefail + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +source "${script_dir}/dependency-image/lib.sh" + +# Derive this repo's GHCR namespace from its GitHub origin remote. +image_repo_from_origin() { + local remote_url owner_repo + remote_url="$(git -C "${_REPO_ROOT}" remote get-url origin)" + case "${remote_url}" in + https://github.com/*) owner_repo="${remote_url#https://github.com/}" ;; + git@github.com:*) owner_repo="${remote_url#git@github.com:}" ;; + ssh://git@github.com/*) owner_repo="${remote_url#ssh://git@github.com/}" ;; + *) + echo "ERROR: can't derive GHCR image repo from origin remote: ${remote_url}" >&2 + echo " Expected a github.com remote." >&2 + exit 1 + ;; + esac + owner_repo="${owner_repo%.git}" + printf 'ghcr.io/%s\n' "$(printf '%s' "${owner_repo}" | tr '[:upper:]' '[:lower:]')" +} + +host_platform() { + case "$(uname -m)" in + x86_64) printf 'linux/amd64\n' ;; + aarch64|arm64) printf 'linux/arm64\n' ;; + *) echo "ERROR: unsupported host arch: $(uname -m)" >&2; exit 1 ;; + esac +} + +main() { + local build_env_hash image image_repo platform pull_err + + echo "==> Deriving build-env hash..." >&2 + build_env_hash="$(derive_build_env_hash)" + image_repo="$(image_repo_from_origin)" + image="$(image_ref "${image_repo}" "build-env" "${build_env_hash}")" + platform="$(host_platform)" + + echo " build-env hash: ${build_env_hash}" >&2 + echo " image: ${image}" >&2 + + if docker image inspect "${image}" &>/dev/null; then + echo "==> Found in local Docker cache." >&2 + echo "${image}" + return + fi + + echo "==> Checking repository registry..." >&2 + if pull_err="$(docker pull "${image}" 2>&1)"; then + echo "==> Pulled from repository registry." >&2 + echo "${image}" + return + fi + + echo " docker pull failed; will build from scratch. Pull error:" >&2 + printf '%s\n' "${pull_err}" | sed 's/^/ /' >&2 + + echo "==> Image not available — building from scratch..." >&2 + build_image "${image}" "${platform}" "--load" + echo "==> Built locally." >&2 + echo "${image}" +} + +main diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile new file mode 100644 index 00000000..61b76297 --- /dev/null +++ b/tools/build-packages/dependency-image/Dockerfile @@ -0,0 +1,52 @@ +# syntax=docker/dockerfile:1 +# +# Build-env image for CLP Presto connector packages. +# Installs packaging tools and connector C/C++ dependencies. + +FROM quay.io/pypa/manylinux_2_28:latest + +# Install an optional host CA bundle without copying the bundle into an image layer. +COPY --from=ca-bundle install-ca-bundle.sh /tmp/install-ca-bundle.sh +RUN --mount=type=secret,id=host-ca \ + if [ -s /run/secrets/host-ca ]; then \ + bash /tmp/install-ca-bundle.sh /run/secrets/host-ca; \ + fi \ + && rm -f /tmp/install-ca-bundle.sh + +# Use the system CA bundle for tools that don't read the system trust store. +ENV CURL_CA_BUNDLE=/etc/pki/tls/certs/ca-bundle.crt \ + SSL_CERT_FILE=/etc/pki/tls/certs/ca-bundle.crt \ + REQUESTS_CA_BUNDLE=/etc/pki/tls/certs/ca-bundle.crt \ + PIP_CERT=/etc/pki/tls/certs/ca-bundle.crt + +# Install OS packages missing from the manylinux base image. +RUN dnf install -y --setopt=install_weak_deps=False \ + dpkg gettext git java-17-openjdk-devel libcurl-devel libevent-devel \ + libunwind-devel ninja-build openssl-devel patchelf python3-pip rpm-build \ + && dnf clean all + +# Pin CMake below 4.0 for current CLP dependency builds. +RUN python3 -m pip install --no-cache-dir --upgrade pip \ + && python3 -m pip install --no-cache-dir 'cmake==3.28.*' + +# go-task — task driver for dependency installation and CMake builds. +ARG GO_TASK_VERSION=v3.48.0 +ARG TARGETARCH +RUN set -eux; \ + mkdir -p /opt/go-task/bin; \ + curl -fsSL "https://github.com/go-task/task/releases/download/${GO_TASK_VERSION}/task_linux_${TARGETARCH}.tar.gz" \ + | tar xz -C /opt/go-task/bin task + +ENV PATH=/opt/go-task/bin:${PATH} + +ENV CLP_PLUGIN_BUILD_DIR=/opt/clp-plugin-presto-connector/build +WORKDIR /opt/clp-plugin-presto-connector +COPY --from=repo-root taskfile.yaml ./ +COPY --from=repo-root taskfiles ./taskfiles +COPY --from=repo-root tools/yscope-dev-utils ./tools/yscope-dev-utils + +# Build one dependency at a time; each dependency build still defaults to nproc. +RUN TASK_CONCURRENCY=1 task velox-connector:deps:install-all + +# Marker for scripts to verify they are running in the dependency image. +ENV CLP_PLUGIN_BUILD_ENV=1 diff --git a/tools/build-packages/dependency-image/lib.sh b/tools/build-packages/dependency-image/lib.sh new file mode 100644 index 00000000..0f0ed35e --- /dev/null +++ b/tools/build-packages/dependency-image/lib.sh @@ -0,0 +1,89 @@ +#!/usr/bin/env bash + +# Shared dependency-image helpers for tag derivation and Docker builds. +# Callers decide whether to use a local image, pull from GHCR, or build. + +_DEP_IMG_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +_REPO_ROOT="$(cd "${_DEP_IMG_DIR}/../../.." &>/dev/null && pwd)" + +# Keep local builds working when the checkout lacks initialized submodules. +ensure_yscope_dev_utils_submodule() { + git -C "${_REPO_ROOT}" submodule update --init --recursive tools/yscope-dev-utils +} + +# ── Image identity ──────────────────────────────────────────────────────────── + +# Builds the canonical `:env-` image reference. +# +# Args: +image_ref() { + echo "$1/$2:env-$3" +} + +# Inputs that should change the build-env image tag. +_BUILD_ENV_HASH_INPUTS=( + ".github/workflows/build-dependency-image.yaml" + "taskfile.yaml" + "taskfiles" + "tools/build-packages/build-dependency-image.sh" + "tools/build-packages/dependency-image" + "tools/ca-bundle" + "tools/yscope-dev-utils" +) + +# Computes the 16-hex-char hash used in the image tag. +# +# Requires: git, sha256sum +derive_build_env_hash() { + ( + cd "${_REPO_ROOT}" + ensure_yscope_dev_utils_submodule >&2 + git ls-files -z --recurse-submodules -- "${_BUILD_ENV_HASH_INPUTS[@]}" \ + | sort -z \ + | xargs -0 sha256sum \ + | sha256sum \ + | cut -c1-16 + ) +} + +# ── Docker build ────────────────────────────────────────────────────────────── + +# Builds the dependency image. +# +# Args: +# $1 image tag — e.g. ghcr.io/owner/build-env:env- +# $2 platform — linux/amd64 or linux/arm64 +# $3 output flag — --push (registry) or --load (local docker) +# +# Requires: docker buildx, git +build_image() { + local tag="$1" platform="$2" output="$3" + + # Mount the host CA bundle as a BuildKit secret so the bundle bytes stay + # out of the image layers and build context. An empty file means no host CA. + local ca_stage; ca_stage=$(mktemp -d) + trap "rm -rf '${ca_stage}'" RETURN + local ca_bundle="${ca_stage}/host-ca" + if ! "${_REPO_ROOT}/tools/ca-bundle/stage-ca-bundle.sh" "${ca_bundle}"; then + : > "${ca_bundle}" + fi + + # Stage the minimal repo context needed to run the dependency-install task. + ensure_yscope_dev_utils_submodule + + local repo_context="${ca_stage}/repo-root" + mkdir -p "${repo_context}/tools" + cp "${_REPO_ROOT}/taskfile.yaml" "${repo_context}/taskfile.yaml" + cp -a "${_REPO_ROOT}/taskfiles" "${repo_context}/taskfiles" + cp -a "${_REPO_ROOT}/tools/yscope-dev-utils" "${repo_context}/tools/yscope-dev-utils" + + docker buildx build \ + --platform "${platform}" \ + --build-context "ca-bundle=${_REPO_ROOT}/tools/ca-bundle" \ + --build-context "repo-root=${repo_context}" \ + --secret "id=host-ca,src=${ca_bundle}" \ + --tag "${tag}" \ + "${output}" \ + -f "${_DEP_IMG_DIR}/Dockerfile" \ + "${_DEP_IMG_DIR}" +} diff --git a/tools/ca-bundle/ca-bundle.sh b/tools/ca-bundle/ca-bundle.sh new file mode 100644 index 00000000..539a1896 --- /dev/null +++ b/tools/ca-bundle/ca-bundle.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Stage the host's CA certificate bundle for container builds. +# Useful when corporate TLS interception adds roots trusted by the host but not +# by base images. +# +# Public API: +# stage_host_ca_bundle # detect + copy; errors if none found +# +# Override detection by setting SSL_CERT_FILE before calling. + +_detect_host_ca_bundle() { + local paths=( + "${SSL_CERT_FILE:-}" + /etc/ssl/certs/ca-certificates.crt # Debian/Ubuntu/Alpine + /etc/pki/tls/certs/ca-bundle.crt # RHEL/CentOS/Fedora + /etc/ssl/cert.pem # macOS + ) + for p in "${paths[@]}"; do + [[ -n "${p}" && -f "${p}" ]] && { echo "${p}"; return 0; } + done + return 1 +} + +stage_host_ca_bundle() { + local dest="${1:?stage_host_ca_bundle requires a destination path}" + local src + if ! src="$(_detect_host_ca_bundle)"; then + echo "ERROR: no CA certificate bundle found on host" >&2 + echo " expected one of /etc/ssl/certs/ca-certificates.crt," >&2 + echo " /etc/pki/tls/certs/ca-bundle.crt, or /etc/ssl/cert.pem" >&2 + echo " set SSL_CERT_FILE to override" >&2 + return 1 + fi + echo "==> Staging host CA bundle: ${src} -> ${dest}" >&2 + cp "${src}" "${dest}" +} diff --git a/tools/ca-bundle/install-ca-bundle.sh b/tools/ca-bundle/install-ca-bundle.sh new file mode 100755 index 00000000..115be887 --- /dev/null +++ b/tools/ca-bundle/install-ca-bundle.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# Install a CA bundle into the container's RHEL-family trust store. +# Pairs with ca-bundle.sh's host-side staging. +# +# Usage: install-ca-bundle.sh +set -eux + +bundle="${1:?install-ca-bundle.sh requires a bundle path}" + +if [[ ! -s "${bundle}" ]]; then + echo "ERROR: ${bundle} is empty or missing." >&2 + echo " Stage via tools/ca-bundle/stage-ca-bundle.sh first." >&2 + exit 1 +fi + +cp "${bundle}" /etc/pki/tls/certs/ca-bundle.crt +cp "${bundle}" /etc/pki/ca-trust/source/anchors/host-ca-bundle.crt +update-ca-trust extract diff --git a/tools/ca-bundle/stage-ca-bundle.sh b/tools/ca-bundle/stage-ca-bundle.sh new file mode 100755 index 00000000..9ae3af42 --- /dev/null +++ b/tools/ca-bundle/stage-ca-bundle.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# Stage the host's CA certificate bundle to a build-context path. +# See ca-bundle.sh for motivation. +# +# Usage: stage-ca-bundle.sh + +set -o errexit +set -o nounset +set -o pipefail + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" +source "${script_dir}/ca-bundle.sh" + +stage_host_ca_bundle "${1:?stage-ca-bundle.sh requires a destination path}" From a2c3d1489c4e270124c24afa117ae9df7d5c8b9d Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Wed, 8 Jul 2026 23:34:03 -0700 Subject: [PATCH 02/39] ci(packaging): Validate build-env image on pull requests --- .github/workflows/build-dependency-image.yaml | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-dependency-image.yaml b/.github/workflows/build-dependency-image.yaml index ee1b89f9..ad969e6e 100644 --- a/.github/workflows/build-dependency-image.yaml +++ b/.github/workflows/build-dependency-image.yaml @@ -1,13 +1,23 @@ # Publishes the content-addressed build-env image used by package builds. +# Pull requests build the image locally without publishing it. # # Flow: -# plan derive the env- image reference and check GHCR -# build publish per-architecture images when the tag is missing +# plan derive the env- image reference and decide whether to build +# build validate or publish per-architecture images # manifest publish the multi-architecture env- tag name: "build-dependency-image" on: + pull_request: + paths: + - ".github/workflows/build-dependency-image.yaml" + - "taskfile.yaml" + - "taskfiles/**" + - "tools/build-packages/build-dependency-image.sh" + - "tools/build-packages/dependency-image/**" + - "tools/ca-bundle/**" + - "tools/yscope-dev-utils" workflow_call: outputs: image: @@ -46,18 +56,22 @@ jobs: echo "ref=${image}" >> "$GITHUB_OUTPUT" - name: "Log in to GHCR" + if: "github.event_name != 'pull_request'" uses: "docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9" # v3.7.0 with: registry: "ghcr.io" username: "${{github.actor}}" password: "${{secrets.GITHUB_TOKEN}}" - - name: "Decide whether to rebuild" + - name: "Decide whether to build" id: "decide" env: IMAGE: "${{steps.image.outputs.ref}}" run: |- - if docker buildx imagetools inspect "${IMAGE}" &>/dev/null; then + if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then + echo "::notice::Pull request validation will build ${IMAGE} locally without publishing" + needs_build=true + elif docker buildx imagetools inspect "${IMAGE}" &>/dev/null; then echo "::notice::${IMAGE} already exists — skipping rebuild" needs_build=false else @@ -88,6 +102,7 @@ jobs: uses: "actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5" # v4.3.1 - name: "Log in to GHCR" + if: "github.event_name != 'pull_request'" uses: "docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9" # v3.7.0 with: registry: "ghcr.io" @@ -97,17 +112,21 @@ jobs: - name: "Set up Docker Buildx" uses: "docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f" # v3.12.0 - - name: "Build and push per-arch dependency image" + - name: "Build per-arch dependency image" env: IMAGE: "${{needs.plan.outputs.image}}" ARCH: "${{matrix.arch}}" run: |- source tools/build-packages/dependency-image/lib.sh - build_image "${IMAGE}-${ARCH}" "linux/${ARCH}" "--push" + output="--push" + if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then + output="--load" + fi + build_image "${IMAGE}-${ARCH}" "linux/${ARCH}" "${output}" manifest: needs: ["plan", "build"] - if: "needs.plan.outputs.needs-build == 'true'" + if: "github.event_name != 'pull_request' && needs.plan.outputs.needs-build == 'true'" permissions: packages: "write" runs-on: "ubuntu-24.04" From fa12a14b1cffcd2f4e95b2d1ad4c4b2a0c02f16e Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 09:13:05 -0700 Subject: [PATCH 03/39] refactor(packaging): Use repository root as build-env context --- tools/build-packages/dependency-image/Dockerfile | 11 ++++++----- tools/build-packages/dependency-image/lib.sh | 11 +---------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index 61b76297..e7c947f1 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -6,7 +6,7 @@ FROM quay.io/pypa/manylinux_2_28:latest # Install an optional host CA bundle without copying the bundle into an image layer. -COPY --from=ca-bundle install-ca-bundle.sh /tmp/install-ca-bundle.sh +COPY tools/ca-bundle/install-ca-bundle.sh /tmp/install-ca-bundle.sh RUN --mount=type=secret,id=host-ca \ if [ -s /run/secrets/host-ca ]; then \ bash /tmp/install-ca-bundle.sh /run/secrets/host-ca; \ @@ -41,12 +41,13 @@ ENV PATH=/opt/go-task/bin:${PATH} ENV CLP_PLUGIN_BUILD_DIR=/opt/clp-plugin-presto-connector/build WORKDIR /opt/clp-plugin-presto-connector -COPY --from=repo-root taskfile.yaml ./ -COPY --from=repo-root taskfiles ./taskfiles -COPY --from=repo-root tools/yscope-dev-utils ./tools/yscope-dev-utils +RUN mkdir -p tools # Build one dependency at a time; each dependency build still defaults to nproc. -RUN TASK_CONCURRENCY=1 task velox-connector:deps:install-all +RUN --mount=type=bind,source=taskfile.yaml,target=/opt/clp-plugin-presto-connector/taskfile.yaml,readonly \ + --mount=type=bind,source=taskfiles,target=/opt/clp-plugin-presto-connector/taskfiles,readonly \ + --mount=type=bind,source=tools/yscope-dev-utils,target=/opt/clp-plugin-presto-connector/tools/yscope-dev-utils,readonly \ + TASK_CONCURRENCY=1 task velox-connector:deps:install-all # Marker for scripts to verify they are running in the dependency image. ENV CLP_PLUGIN_BUILD_ENV=1 diff --git a/tools/build-packages/dependency-image/lib.sh b/tools/build-packages/dependency-image/lib.sh index 0f0ed35e..9000ed1a 100644 --- a/tools/build-packages/dependency-image/lib.sh +++ b/tools/build-packages/dependency-image/lib.sh @@ -68,22 +68,13 @@ build_image() { : > "${ca_bundle}" fi - # Stage the minimal repo context needed to run the dependency-install task. ensure_yscope_dev_utils_submodule - local repo_context="${ca_stage}/repo-root" - mkdir -p "${repo_context}/tools" - cp "${_REPO_ROOT}/taskfile.yaml" "${repo_context}/taskfile.yaml" - cp -a "${_REPO_ROOT}/taskfiles" "${repo_context}/taskfiles" - cp -a "${_REPO_ROOT}/tools/yscope-dev-utils" "${repo_context}/tools/yscope-dev-utils" - docker buildx build \ --platform "${platform}" \ - --build-context "ca-bundle=${_REPO_ROOT}/tools/ca-bundle" \ - --build-context "repo-root=${repo_context}" \ --secret "id=host-ca,src=${ca_bundle}" \ --tag "${tag}" \ "${output}" \ -f "${_DEP_IMG_DIR}/Dockerfile" \ - "${_DEP_IMG_DIR}" + "${_REPO_ROOT}" } From 5ebfec7ba68100b5ad638ee94131bcf2db0591f2 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 09:15:40 -0700 Subject: [PATCH 04/39] refactor(packaging): Simplify build-env helper paths --- tools/build-packages/dependency-image/lib.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/build-packages/dependency-image/lib.sh b/tools/build-packages/dependency-image/lib.sh index 9000ed1a..3418ae8e 100644 --- a/tools/build-packages/dependency-image/lib.sh +++ b/tools/build-packages/dependency-image/lib.sh @@ -3,8 +3,7 @@ # Shared dependency-image helpers for tag derivation and Docker builds. # Callers decide whether to use a local image, pull from GHCR, or build. -_DEP_IMG_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -_REPO_ROOT="$(cd "${_DEP_IMG_DIR}/../../.." &>/dev/null && pwd)" +_REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." &>/dev/null && pwd)" # Keep local builds working when the checkout lacks initialized submodules. ensure_yscope_dev_utils_submodule() { @@ -75,6 +74,6 @@ build_image() { --secret "id=host-ca,src=${ca_bundle}" \ --tag "${tag}" \ "${output}" \ - -f "${_DEP_IMG_DIR}/Dockerfile" \ + -f "${_REPO_ROOT}/tools/build-packages/dependency-image/Dockerfile" \ "${_REPO_ROOT}" } From 378bb46c35818efff0b4ec69b35ae1e268279fac Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 09:18:25 -0700 Subject: [PATCH 05/39] refactor(packaging): Simplify build-env Dockerfile --- tools/build-packages/dependency-image/Dockerfile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index e7c947f1..e6121606 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -26,8 +26,7 @@ RUN dnf install -y --setopt=install_weak_deps=False \ && dnf clean all # Pin CMake below 4.0 for current CLP dependency builds. -RUN python3 -m pip install --no-cache-dir --upgrade pip \ - && python3 -m pip install --no-cache-dir 'cmake==3.28.*' +RUN python3 -m pip install --no-cache-dir 'cmake==3.28.*' # go-task — task driver for dependency installation and CMake builds. ARG GO_TASK_VERSION=v3.48.0 @@ -48,6 +47,3 @@ RUN --mount=type=bind,source=taskfile.yaml,target=/opt/clp-plugin-presto-connect --mount=type=bind,source=taskfiles,target=/opt/clp-plugin-presto-connector/taskfiles,readonly \ --mount=type=bind,source=tools/yscope-dev-utils,target=/opt/clp-plugin-presto-connector/tools/yscope-dev-utils,readonly \ TASK_CONCURRENCY=1 task velox-connector:deps:install-all - -# Marker for scripts to verify they are running in the dependency image. -ENV CLP_PLUGIN_BUILD_ENV=1 From c86c4151b56fc32679b9f7398030104984fa1e61 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 09:36:04 -0700 Subject: [PATCH 06/39] refactor(packaging): Mount repository during build-env setup --- taskfile.yaml | 3 ++- tools/build-packages/dependency-image/Dockerfile | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/taskfile.yaml b/taskfile.yaml index ca323e2e..eaebcefe 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -6,7 +6,8 @@ includes: velox-connector: "taskfiles/velox-connector/main.yaml" vars: - G_BUILD_DIR: '{{.CLP_PLUGIN_BUILD_DIR | default (printf "%s/build" .ROOT_DIR)}}' + DEFAULT_CLP_PLUGIN_BUILD_DIR: "{{.ROOT_DIR}}/build" + G_BUILD_DIR: '{{default .DEFAULT_CLP_PLUGIN_BUILD_DIR (env "CLP_PLUGIN_BUILD_DIR")}}' tasks: clean: diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index e6121606..65411a6d 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -39,11 +39,9 @@ RUN set -eux; \ ENV PATH=/opt/go-task/bin:${PATH} ENV CLP_PLUGIN_BUILD_DIR=/opt/clp-plugin-presto-connector/build -WORKDIR /opt/clp-plugin-presto-connector -RUN mkdir -p tools # Build one dependency at a time; each dependency build still defaults to nproc. -RUN --mount=type=bind,source=taskfile.yaml,target=/opt/clp-plugin-presto-connector/taskfile.yaml,readonly \ - --mount=type=bind,source=taskfiles,target=/opt/clp-plugin-presto-connector/taskfiles,readonly \ - --mount=type=bind,source=tools/yscope-dev-utils,target=/opt/clp-plugin-presto-connector/tools/yscope-dev-utils,readonly \ - TASK_CONCURRENCY=1 task velox-connector:deps:install-all +# Bind-mount the repository as readonly build input. Dependency outputs are +# written to CLP_PLUGIN_BUILD_DIR inside the image. +RUN --mount=type=bind,source=.,target=/repo,readonly \ + TASK_CONCURRENCY=1 task -d /repo velox-connector:deps:install-all From 0fb6a989d6cb1d4691fd9a4f6a72c0882365b860 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 09:56:59 -0700 Subject: [PATCH 07/39] fix(packaging): Preserve build-env task metadata --- tools/build-packages/dependency-image/Dockerfile | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index 65411a6d..35d52e6e 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -25,8 +25,10 @@ RUN dnf install -y --setopt=install_weak_deps=False \ libunwind-devel ninja-build openssl-devel patchelf python3-pip rpm-build \ && dnf clean all -# Pin CMake below 4.0 for current CLP dependency builds. -RUN python3 -m pip install --no-cache-dir 'cmake==3.28.*' +# Pin CMake below 4.0 for current CLP dependency builds. Pin a recent pip so +# it selects the pre-built CMake wheel instead of the source tarball. +RUN python3 -m pip install --no-cache-dir 'pip==21.3.1' \ + && python3 -m pip install --no-cache-dir 'cmake==3.28.*' # go-task — task driver for dependency installation and CMake builds. ARG GO_TASK_VERSION=v3.48.0 @@ -39,9 +41,11 @@ RUN set -eux; \ ENV PATH=/opt/go-task/bin:${PATH} ENV CLP_PLUGIN_BUILD_DIR=/opt/clp-plugin-presto-connector/build +ENV TASK_TEMP_DIR=/opt/clp-plugin-presto-connector/.task # Build one dependency at a time; each dependency build still defaults to nproc. -# Bind-mount the repository as readonly build input. Dependency outputs are -# written to CLP_PLUGIN_BUILD_DIR inside the image. +# Bind-mount the repository as readonly build input. Dependency outputs and Task +# checksum metadata are written outside the repository mount so package builds +# can reuse the installed dependencies from the image. RUN --mount=type=bind,source=.,target=/repo,readonly \ TASK_CONCURRENCY=1 task -d /repo velox-connector:deps:install-all From da0610247d967531be8f0ac04deea9fd2cc8fc6f Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 10:11:26 -0700 Subject: [PATCH 08/39] refactor(packaging): Scope CA bundle handling to build-env --- .github/workflows/build-dependency-image.yaml | 1 - .../dependency-image/Dockerfile | 54 +++++++++++++------ .../dependency-image}/ca-bundle/ca-bundle.sh | 0 .../ca-bundle/stage-ca-bundle.sh | 0 tools/build-packages/dependency-image/lib.sh | 3 +- tools/ca-bundle/install-ca-bundle.sh | 18 ------- 6 files changed, 39 insertions(+), 37 deletions(-) rename tools/{ => build-packages/dependency-image}/ca-bundle/ca-bundle.sh (100%) rename tools/{ => build-packages/dependency-image}/ca-bundle/stage-ca-bundle.sh (100%) delete mode 100755 tools/ca-bundle/install-ca-bundle.sh diff --git a/.github/workflows/build-dependency-image.yaml b/.github/workflows/build-dependency-image.yaml index ad969e6e..eb1f1474 100644 --- a/.github/workflows/build-dependency-image.yaml +++ b/.github/workflows/build-dependency-image.yaml @@ -16,7 +16,6 @@ on: - "taskfiles/**" - "tools/build-packages/build-dependency-image.sh" - "tools/build-packages/dependency-image/**" - - "tools/ca-bundle/**" - "tools/yscope-dev-utils" workflow_call: outputs: diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index 35d52e6e..84dc5aae 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -5,35 +5,49 @@ FROM quay.io/pypa/manylinux_2_28:latest -# Install an optional host CA bundle without copying the bundle into an image layer. -COPY tools/ca-bundle/install-ca-bundle.sh /tmp/install-ca-bundle.sh +# When available, expose the host CA bundle only to networked build steps via +# tool-specific environment variables. This supports local corporate builds +# without baking host CA certificates into the final image. + +# Install OS packages missing from the manylinux base image. RUN --mount=type=secret,id=host-ca \ if [ -s /run/secrets/host-ca ]; then \ - bash /tmp/install-ca-bundle.sh /run/secrets/host-ca; \ + export CURL_CA_BUNDLE=/run/secrets/host-ca \ + GIT_SSL_CAINFO=/run/secrets/host-ca \ + PIP_CERT=/run/secrets/host-ca \ + REQUESTS_CA_BUNDLE=/run/secrets/host-ca \ + SSL_CERT_FILE=/run/secrets/host-ca; \ fi \ - && rm -f /tmp/install-ca-bundle.sh - -# Use the system CA bundle for tools that don't read the system trust store. -ENV CURL_CA_BUNDLE=/etc/pki/tls/certs/ca-bundle.crt \ - SSL_CERT_FILE=/etc/pki/tls/certs/ca-bundle.crt \ - REQUESTS_CA_BUNDLE=/etc/pki/tls/certs/ca-bundle.crt \ - PIP_CERT=/etc/pki/tls/certs/ca-bundle.crt - -# Install OS packages missing from the manylinux base image. -RUN dnf install -y --setopt=install_weak_deps=False \ + && dnf install -y --setopt=install_weak_deps=False \ dpkg gettext git java-17-openjdk-devel libcurl-devel libevent-devel \ libunwind-devel ninja-build openssl-devel patchelf python3-pip rpm-build \ && dnf clean all # Pin CMake below 4.0 for current CLP dependency builds. Pin a recent pip so # it selects the pre-built CMake wheel instead of the source tarball. -RUN python3 -m pip install --no-cache-dir 'pip==21.3.1' \ +RUN --mount=type=secret,id=host-ca \ + if [ -s /run/secrets/host-ca ]; then \ + export CURL_CA_BUNDLE=/run/secrets/host-ca \ + GIT_SSL_CAINFO=/run/secrets/host-ca \ + PIP_CERT=/run/secrets/host-ca \ + REQUESTS_CA_BUNDLE=/run/secrets/host-ca \ + SSL_CERT_FILE=/run/secrets/host-ca; \ + fi \ + && python3 -m pip install --no-cache-dir 'pip==21.3.1' \ && python3 -m pip install --no-cache-dir 'cmake==3.28.*' # go-task — task driver for dependency installation and CMake builds. ARG GO_TASK_VERSION=v3.48.0 ARG TARGETARCH -RUN set -eux; \ +RUN --mount=type=secret,id=host-ca \ + set -eux; \ + if [ -s /run/secrets/host-ca ]; then \ + export CURL_CA_BUNDLE=/run/secrets/host-ca \ + GIT_SSL_CAINFO=/run/secrets/host-ca \ + PIP_CERT=/run/secrets/host-ca \ + REQUESTS_CA_BUNDLE=/run/secrets/host-ca \ + SSL_CERT_FILE=/run/secrets/host-ca; \ + fi; \ mkdir -p /opt/go-task/bin; \ curl -fsSL "https://github.com/go-task/task/releases/download/${GO_TASK_VERSION}/task_linux_${TARGETARCH}.tar.gz" \ | tar xz -C /opt/go-task/bin task @@ -48,4 +62,12 @@ ENV TASK_TEMP_DIR=/opt/clp-plugin-presto-connector/.task # checksum metadata are written outside the repository mount so package builds # can reuse the installed dependencies from the image. RUN --mount=type=bind,source=.,target=/repo,readonly \ - TASK_CONCURRENCY=1 task -d /repo velox-connector:deps:install-all + --mount=type=secret,id=host-ca \ + if [ -s /run/secrets/host-ca ]; then \ + export CURL_CA_BUNDLE=/run/secrets/host-ca \ + GIT_SSL_CAINFO=/run/secrets/host-ca \ + PIP_CERT=/run/secrets/host-ca \ + REQUESTS_CA_BUNDLE=/run/secrets/host-ca \ + SSL_CERT_FILE=/run/secrets/host-ca; \ + fi \ + && TASK_CONCURRENCY=1 task -d /repo velox-connector:deps:install-all diff --git a/tools/ca-bundle/ca-bundle.sh b/tools/build-packages/dependency-image/ca-bundle/ca-bundle.sh similarity index 100% rename from tools/ca-bundle/ca-bundle.sh rename to tools/build-packages/dependency-image/ca-bundle/ca-bundle.sh diff --git a/tools/ca-bundle/stage-ca-bundle.sh b/tools/build-packages/dependency-image/ca-bundle/stage-ca-bundle.sh similarity index 100% rename from tools/ca-bundle/stage-ca-bundle.sh rename to tools/build-packages/dependency-image/ca-bundle/stage-ca-bundle.sh diff --git a/tools/build-packages/dependency-image/lib.sh b/tools/build-packages/dependency-image/lib.sh index 3418ae8e..8ce94884 100644 --- a/tools/build-packages/dependency-image/lib.sh +++ b/tools/build-packages/dependency-image/lib.sh @@ -26,7 +26,6 @@ _BUILD_ENV_HASH_INPUTS=( "taskfiles" "tools/build-packages/build-dependency-image.sh" "tools/build-packages/dependency-image" - "tools/ca-bundle" "tools/yscope-dev-utils" ) @@ -63,7 +62,7 @@ build_image() { local ca_stage; ca_stage=$(mktemp -d) trap "rm -rf '${ca_stage}'" RETURN local ca_bundle="${ca_stage}/host-ca" - if ! "${_REPO_ROOT}/tools/ca-bundle/stage-ca-bundle.sh" "${ca_bundle}"; then + if ! "${_REPO_ROOT}/tools/build-packages/dependency-image/ca-bundle/stage-ca-bundle.sh" "${ca_bundle}"; then : > "${ca_bundle}" fi diff --git a/tools/ca-bundle/install-ca-bundle.sh b/tools/ca-bundle/install-ca-bundle.sh deleted file mode 100755 index 115be887..00000000 --- a/tools/ca-bundle/install-ca-bundle.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -# Install a CA bundle into the container's RHEL-family trust store. -# Pairs with ca-bundle.sh's host-side staging. -# -# Usage: install-ca-bundle.sh -set -eux - -bundle="${1:?install-ca-bundle.sh requires a bundle path}" - -if [[ ! -s "${bundle}" ]]; then - echo "ERROR: ${bundle} is empty or missing." >&2 - echo " Stage via tools/ca-bundle/stage-ca-bundle.sh first." >&2 - exit 1 -fi - -cp "${bundle}" /etc/pki/tls/certs/ca-bundle.crt -cp "${bundle}" /etc/pki/ca-trust/source/anchors/host-ca-bundle.crt -update-ca-trust extract From a087bcd372d37965038d849b308ce6676d5c4790 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 10:33:47 -0700 Subject: [PATCH 09/39] fix(packaging): Support corporate CA bundles larger than BuildKit's secret limit BuildKit caps `--mount=type=secret` payloads at 500KiB, but corporate CA bundles routinely exceed that (e.g. Zscaler-intercepted bundles), so the dependency image failed to build in proxied environments. Mount the CA bundle via a named build context instead, which bind-mounts it without the size cap while still keeping the bytes out of the build context and image layers. Also give dnf its own `--setopt=sslcacert` since, unlike curl/git/pip, it talks to libcurl directly and ignores the `CURL_CA_BUNDLE`/`SSL_CERT_FILE` env vars. --- tools/build-packages/dependency-image/Dockerfile | 14 +++++++++----- tools/build-packages/dependency-image/lib.sh | 9 ++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index 84dc5aae..e31956c1 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -10,22 +10,26 @@ FROM quay.io/pypa/manylinux_2_28:latest # without baking host CA certificates into the final image. # Install OS packages missing from the manylinux base image. -RUN --mount=type=secret,id=host-ca \ +# dnf talks to libcurl directly and ignores CURL_CA_BUNDLE/SSL_CERT_FILE, so +# it needs its own --setopt=sslcacert pointed at the host CA bundle. +RUN --mount=type=bind,from=host-ca,source=host-ca,target=/run/secrets/host-ca \ + dnf_sslcacert_opt=""; \ if [ -s /run/secrets/host-ca ]; then \ export CURL_CA_BUNDLE=/run/secrets/host-ca \ GIT_SSL_CAINFO=/run/secrets/host-ca \ PIP_CERT=/run/secrets/host-ca \ REQUESTS_CA_BUNDLE=/run/secrets/host-ca \ SSL_CERT_FILE=/run/secrets/host-ca; \ + dnf_sslcacert_opt="--setopt=sslcacert=/run/secrets/host-ca"; \ fi \ - && dnf install -y --setopt=install_weak_deps=False \ + && dnf install -y --setopt=install_weak_deps=False ${dnf_sslcacert_opt} \ dpkg gettext git java-17-openjdk-devel libcurl-devel libevent-devel \ libunwind-devel ninja-build openssl-devel patchelf python3-pip rpm-build \ && dnf clean all # Pin CMake below 4.0 for current CLP dependency builds. Pin a recent pip so # it selects the pre-built CMake wheel instead of the source tarball. -RUN --mount=type=secret,id=host-ca \ +RUN --mount=type=bind,from=host-ca,source=host-ca,target=/run/secrets/host-ca \ if [ -s /run/secrets/host-ca ]; then \ export CURL_CA_BUNDLE=/run/secrets/host-ca \ GIT_SSL_CAINFO=/run/secrets/host-ca \ @@ -39,7 +43,7 @@ RUN --mount=type=secret,id=host-ca \ # go-task — task driver for dependency installation and CMake builds. ARG GO_TASK_VERSION=v3.48.0 ARG TARGETARCH -RUN --mount=type=secret,id=host-ca \ +RUN --mount=type=bind,from=host-ca,source=host-ca,target=/run/secrets/host-ca \ set -eux; \ if [ -s /run/secrets/host-ca ]; then \ export CURL_CA_BUNDLE=/run/secrets/host-ca \ @@ -62,7 +66,7 @@ ENV TASK_TEMP_DIR=/opt/clp-plugin-presto-connector/.task # checksum metadata are written outside the repository mount so package builds # can reuse the installed dependencies from the image. RUN --mount=type=bind,source=.,target=/repo,readonly \ - --mount=type=secret,id=host-ca \ + --mount=type=bind,from=host-ca,source=host-ca,target=/run/secrets/host-ca \ if [ -s /run/secrets/host-ca ]; then \ export CURL_CA_BUNDLE=/run/secrets/host-ca \ GIT_SSL_CAINFO=/run/secrets/host-ca \ diff --git a/tools/build-packages/dependency-image/lib.sh b/tools/build-packages/dependency-image/lib.sh index 8ce94884..cd3a5a67 100644 --- a/tools/build-packages/dependency-image/lib.sh +++ b/tools/build-packages/dependency-image/lib.sh @@ -57,8 +57,11 @@ derive_build_env_hash() { build_image() { local tag="$1" platform="$2" output="$3" - # Mount the host CA bundle as a BuildKit secret so the bundle bytes stay - # out of the image layers and build context. An empty file means no host CA. + # Mount the host CA bundle via a named build context (bind-mounted in the + # Dockerfile) so the bundle bytes stay out of the image layers and the + # primary build context. A BuildKit secret can't be used here since + # secrets are capped at 500KiB and corporate CA bundles routinely exceed + # that. An empty file means no host CA. local ca_stage; ca_stage=$(mktemp -d) trap "rm -rf '${ca_stage}'" RETURN local ca_bundle="${ca_stage}/host-ca" @@ -70,7 +73,7 @@ build_image() { docker buildx build \ --platform "${platform}" \ - --secret "id=host-ca,src=${ca_bundle}" \ + --build-context "host-ca=${ca_stage}" \ --tag "${tag}" \ "${output}" \ -f "${_REPO_ROOT}/tools/build-packages/dependency-image/Dockerfile" \ From 14c3e7dbcec6c646f34a90700855fc6fad8ff0cc Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 10:55:51 -0700 Subject: [PATCH 10/39] fix(packaging): Simplify host CA staging --- .../dependency-image/Dockerfile | 60 ++++++++--------- .../dependency-image/ca-bundle/ca-bundle.sh | 36 ----------- .../ca-bundle/stage-ca-bundle.sh | 15 ----- tools/build-packages/dependency-image/lib.sh | 64 +++++++++++++------ 4 files changed, 75 insertions(+), 100 deletions(-) delete mode 100644 tools/build-packages/dependency-image/ca-bundle/ca-bundle.sh delete mode 100755 tools/build-packages/dependency-image/ca-bundle/stage-ca-bundle.sh diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index e31956c1..314f8d65 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -5,6 +5,8 @@ FROM quay.io/pypa/manylinux_2_28:latest +ARG HOST_CA_BUNDLE=/run/secrets/host-ca + # When available, expose the host CA bundle only to networked build steps via # tool-specific environment variables. This supports local corporate builds # without baking host CA certificates into the final image. @@ -12,15 +14,15 @@ FROM quay.io/pypa/manylinux_2_28:latest # Install OS packages missing from the manylinux base image. # dnf talks to libcurl directly and ignores CURL_CA_BUNDLE/SSL_CERT_FILE, so # it needs its own --setopt=sslcacert pointed at the host CA bundle. -RUN --mount=type=bind,from=host-ca,source=host-ca,target=/run/secrets/host-ca \ +RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ dnf_sslcacert_opt=""; \ - if [ -s /run/secrets/host-ca ]; then \ - export CURL_CA_BUNDLE=/run/secrets/host-ca \ - GIT_SSL_CAINFO=/run/secrets/host-ca \ - PIP_CERT=/run/secrets/host-ca \ - REQUESTS_CA_BUNDLE=/run/secrets/host-ca \ - SSL_CERT_FILE=/run/secrets/host-ca; \ - dnf_sslcacert_opt="--setopt=sslcacert=/run/secrets/host-ca"; \ + if [ -s "${HOST_CA_BUNDLE}" ]; then \ + export CURL_CA_BUNDLE="${HOST_CA_BUNDLE}" \ + GIT_SSL_CAINFO="${HOST_CA_BUNDLE}" \ + PIP_CERT="${HOST_CA_BUNDLE}" \ + REQUESTS_CA_BUNDLE="${HOST_CA_BUNDLE}" \ + SSL_CERT_FILE="${HOST_CA_BUNDLE}"; \ + dnf_sslcacert_opt="--setopt=sslcacert=${HOST_CA_BUNDLE}"; \ fi \ && dnf install -y --setopt=install_weak_deps=False ${dnf_sslcacert_opt} \ dpkg gettext git java-17-openjdk-devel libcurl-devel libevent-devel \ @@ -29,13 +31,13 @@ RUN --mount=type=bind,from=host-ca,source=host-ca,target=/run/secrets/host-ca \ # Pin CMake below 4.0 for current CLP dependency builds. Pin a recent pip so # it selects the pre-built CMake wheel instead of the source tarball. -RUN --mount=type=bind,from=host-ca,source=host-ca,target=/run/secrets/host-ca \ - if [ -s /run/secrets/host-ca ]; then \ - export CURL_CA_BUNDLE=/run/secrets/host-ca \ - GIT_SSL_CAINFO=/run/secrets/host-ca \ - PIP_CERT=/run/secrets/host-ca \ - REQUESTS_CA_BUNDLE=/run/secrets/host-ca \ - SSL_CERT_FILE=/run/secrets/host-ca; \ +RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ + if [ -s "${HOST_CA_BUNDLE}" ]; then \ + export CURL_CA_BUNDLE="${HOST_CA_BUNDLE}" \ + GIT_SSL_CAINFO="${HOST_CA_BUNDLE}" \ + PIP_CERT="${HOST_CA_BUNDLE}" \ + REQUESTS_CA_BUNDLE="${HOST_CA_BUNDLE}" \ + SSL_CERT_FILE="${HOST_CA_BUNDLE}"; \ fi \ && python3 -m pip install --no-cache-dir 'pip==21.3.1' \ && python3 -m pip install --no-cache-dir 'cmake==3.28.*' @@ -43,14 +45,14 @@ RUN --mount=type=bind,from=host-ca,source=host-ca,target=/run/secrets/host-ca \ # go-task — task driver for dependency installation and CMake builds. ARG GO_TASK_VERSION=v3.48.0 ARG TARGETARCH -RUN --mount=type=bind,from=host-ca,source=host-ca,target=/run/secrets/host-ca \ +RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ set -eux; \ - if [ -s /run/secrets/host-ca ]; then \ - export CURL_CA_BUNDLE=/run/secrets/host-ca \ - GIT_SSL_CAINFO=/run/secrets/host-ca \ - PIP_CERT=/run/secrets/host-ca \ - REQUESTS_CA_BUNDLE=/run/secrets/host-ca \ - SSL_CERT_FILE=/run/secrets/host-ca; \ + if [ -s "${HOST_CA_BUNDLE}" ]; then \ + export CURL_CA_BUNDLE="${HOST_CA_BUNDLE}" \ + GIT_SSL_CAINFO="${HOST_CA_BUNDLE}" \ + PIP_CERT="${HOST_CA_BUNDLE}" \ + REQUESTS_CA_BUNDLE="${HOST_CA_BUNDLE}" \ + SSL_CERT_FILE="${HOST_CA_BUNDLE}"; \ fi; \ mkdir -p /opt/go-task/bin; \ curl -fsSL "https://github.com/go-task/task/releases/download/${GO_TASK_VERSION}/task_linux_${TARGETARCH}.tar.gz" \ @@ -66,12 +68,12 @@ ENV TASK_TEMP_DIR=/opt/clp-plugin-presto-connector/.task # checksum metadata are written outside the repository mount so package builds # can reuse the installed dependencies from the image. RUN --mount=type=bind,source=.,target=/repo,readonly \ - --mount=type=bind,from=host-ca,source=host-ca,target=/run/secrets/host-ca \ - if [ -s /run/secrets/host-ca ]; then \ - export CURL_CA_BUNDLE=/run/secrets/host-ca \ - GIT_SSL_CAINFO=/run/secrets/host-ca \ - PIP_CERT=/run/secrets/host-ca \ - REQUESTS_CA_BUNDLE=/run/secrets/host-ca \ - SSL_CERT_FILE=/run/secrets/host-ca; \ + --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ + if [ -s "${HOST_CA_BUNDLE}" ]; then \ + export CURL_CA_BUNDLE="${HOST_CA_BUNDLE}" \ + GIT_SSL_CAINFO="${HOST_CA_BUNDLE}" \ + PIP_CERT="${HOST_CA_BUNDLE}" \ + REQUESTS_CA_BUNDLE="${HOST_CA_BUNDLE}" \ + SSL_CERT_FILE="${HOST_CA_BUNDLE}"; \ fi \ && TASK_CONCURRENCY=1 task -d /repo velox-connector:deps:install-all diff --git a/tools/build-packages/dependency-image/ca-bundle/ca-bundle.sh b/tools/build-packages/dependency-image/ca-bundle/ca-bundle.sh deleted file mode 100644 index 539a1896..00000000 --- a/tools/build-packages/dependency-image/ca-bundle/ca-bundle.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash -# Stage the host's CA certificate bundle for container builds. -# Useful when corporate TLS interception adds roots trusted by the host but not -# by base images. -# -# Public API: -# stage_host_ca_bundle # detect + copy; errors if none found -# -# Override detection by setting SSL_CERT_FILE before calling. - -_detect_host_ca_bundle() { - local paths=( - "${SSL_CERT_FILE:-}" - /etc/ssl/certs/ca-certificates.crt # Debian/Ubuntu/Alpine - /etc/pki/tls/certs/ca-bundle.crt # RHEL/CentOS/Fedora - /etc/ssl/cert.pem # macOS - ) - for p in "${paths[@]}"; do - [[ -n "${p}" && -f "${p}" ]] && { echo "${p}"; return 0; } - done - return 1 -} - -stage_host_ca_bundle() { - local dest="${1:?stage_host_ca_bundle requires a destination path}" - local src - if ! src="$(_detect_host_ca_bundle)"; then - echo "ERROR: no CA certificate bundle found on host" >&2 - echo " expected one of /etc/ssl/certs/ca-certificates.crt," >&2 - echo " /etc/pki/tls/certs/ca-bundle.crt, or /etc/ssl/cert.pem" >&2 - echo " set SSL_CERT_FILE to override" >&2 - return 1 - fi - echo "==> Staging host CA bundle: ${src} -> ${dest}" >&2 - cp "${src}" "${dest}" -} diff --git a/tools/build-packages/dependency-image/ca-bundle/stage-ca-bundle.sh b/tools/build-packages/dependency-image/ca-bundle/stage-ca-bundle.sh deleted file mode 100755 index 9ae3af42..00000000 --- a/tools/build-packages/dependency-image/ca-bundle/stage-ca-bundle.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -# Stage the host's CA certificate bundle to a build-context path. -# See ca-bundle.sh for motivation. -# -# Usage: stage-ca-bundle.sh - -set -o errexit -set -o nounset -set -o pipefail - -script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${script_dir}/ca-bundle.sh" - -stage_host_ca_bundle "${1:?stage-ca-bundle.sh requires a destination path}" diff --git a/tools/build-packages/dependency-image/lib.sh b/tools/build-packages/dependency-image/lib.sh index cd3a5a67..96fa7de7 100644 --- a/tools/build-packages/dependency-image/lib.sh +++ b/tools/build-packages/dependency-image/lib.sh @@ -44,6 +44,30 @@ derive_build_env_hash() { ) } +# Stages the host CA bundle into the temporary Docker build context. +# +# Args: +_stage_host_ca_bundle() { + local dest="${1:?_stage_host_ca_bundle requires a destination path}" + local ca_bundle_candidates=( + "${SSL_CERT_FILE:-}" + /etc/ssl/certs/ca-certificates.crt + /etc/pki/tls/certs/ca-bundle.crt + /etc/ssl/cert.pem + ) + + local src + for src in "${ca_bundle_candidates[@]}"; do + [[ -f "${src}" && -s "${src}" ]] || continue + echo "==> Staging host CA bundle: ${src} -> ${dest}" >&2 + cp "${src}" "${dest}" + return 0 + done + + echo "==> No host CA bundle found; continuing without host CA context." >&2 + return 1 +} + # ── Docker build ────────────────────────────────────────────────────────────── # Builds the dependency image. @@ -57,25 +81,25 @@ derive_build_env_hash() { build_image() { local tag="$1" platform="$2" output="$3" - # Mount the host CA bundle via a named build context (bind-mounted in the - # Dockerfile) so the bundle bytes stay out of the image layers and the - # primary build context. A BuildKit secret can't be used here since - # secrets are capped at 500KiB and corporate CA bundles routinely exceed - # that. An empty file means no host CA. + # Expose the host CA bundle as a narrow named build context so the Dockerfile + # can bind-mount it during networked RUN steps without baking it into image + # layers. Use a real context instead of a BuildKit secret because corporate CA + # bundles can exceed BuildKit's 500KiB secret limit. local ca_stage; ca_stage=$(mktemp -d) - trap "rm -rf '${ca_stage}'" RETURN - local ca_bundle="${ca_stage}/host-ca" - if ! "${_REPO_ROOT}/tools/build-packages/dependency-image/ca-bundle/stage-ca-bundle.sh" "${ca_bundle}"; then - : > "${ca_bundle}" - fi - - ensure_yscope_dev_utils_submodule - - docker buildx build \ - --platform "${platform}" \ - --build-context "host-ca=${ca_stage}" \ - --tag "${tag}" \ - "${output}" \ - -f "${_REPO_ROOT}/tools/build-packages/dependency-image/Dockerfile" \ - "${_REPO_ROOT}" + ( + trap 'rm -rf "${ca_stage}"' EXIT + + local ca_bundle="${ca_stage}/host-ca" + _stage_host_ca_bundle "${ca_bundle}" || : > "${ca_bundle}" + + ensure_yscope_dev_utils_submodule + + docker buildx build \ + --platform "${platform}" \ + --build-context "host-ca=${ca_stage}" \ + --tag "${tag}" \ + "${output}" \ + -f "${_REPO_ROOT}/tools/build-packages/dependency-image/Dockerfile" \ + "${_REPO_ROOT}" + ) } From 200831a21644f10740032bd48cc623d061a4da3a Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 13:48:12 -0700 Subject: [PATCH 11/39] fix(packaging): Harden build-env image context --- .dockerignore | 1 + .github/workflows/build-dependency-image.yaml | 8 +++- .../build-packages/build-dependency-image.sh | 2 +- .../dependency-image/Dockerfile | 38 +++++-------------- .../dependency-image/use-host-ca.sh | 7 ++++ .../dependency-image/{lib.sh => utils.sh} | 3 +- 6 files changed, 26 insertions(+), 33 deletions(-) create mode 100644 .dockerignore create mode 100644 tools/build-packages/dependency-image/use-host-ca.sh rename tools/build-packages/dependency-image/{lib.sh => utils.sh} (98%) diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..6b8710a7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.git diff --git a/.github/workflows/build-dependency-image.yaml b/.github/workflows/build-dependency-image.yaml index eb1f1474..3c755ffe 100644 --- a/.github/workflows/build-dependency-image.yaml +++ b/.github/workflows/build-dependency-image.yaml @@ -44,11 +44,13 @@ jobs: steps: - name: "Check out repository" uses: "actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5" # v4.3.1 + with: + persist-credentials: false - name: "Resolve dependency image" id: "image" run: |- - source tools/build-packages/dependency-image/lib.sh + source tools/build-packages/dependency-image/utils.sh build_env_hash=$(derive_build_env_hash) image_repo="ghcr.io/$(printf '%s' "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')" image=$(image_ref "${image_repo}" "${IMAGE_NAME}" "${build_env_hash}") @@ -99,6 +101,8 @@ jobs: steps: - name: "Check out repository" uses: "actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5" # v4.3.1 + with: + persist-credentials: false - name: "Log in to GHCR" if: "github.event_name != 'pull_request'" @@ -116,7 +120,7 @@ jobs: IMAGE: "${{needs.plan.outputs.image}}" ARCH: "${{matrix.arch}}" run: |- - source tools/build-packages/dependency-image/lib.sh + source tools/build-packages/dependency-image/utils.sh output="--push" if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then output="--load" diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh index 18d78335..f62e29d3 100755 --- a/tools/build-packages/build-dependency-image.sh +++ b/tools/build-packages/build-dependency-image.sh @@ -17,7 +17,7 @@ set -o nounset set -o pipefail script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -source "${script_dir}/dependency-image/lib.sh" +source "${script_dir}/dependency-image/utils.sh" # Derive this repo's GHCR namespace from its GitHub origin remote. image_repo_from_origin() { diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index 314f8d65..4b9d78aa 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -6,22 +6,20 @@ FROM quay.io/pypa/manylinux_2_28:latest ARG HOST_CA_BUNDLE=/run/secrets/host-ca +ARG HOST_CA_ENV=/usr/local/share/clp-plugin-presto-connector/use-host-ca.sh # When available, expose the host CA bundle only to networked build steps via # tool-specific environment variables. This supports local corporate builds # without baking host CA certificates into the final image. +COPY tools/build-packages/dependency-image/use-host-ca.sh ${HOST_CA_ENV} # Install OS packages missing from the manylinux base image. # dnf talks to libcurl directly and ignores CURL_CA_BUNDLE/SSL_CERT_FILE, so # it needs its own --setopt=sslcacert pointed at the host CA bundle. RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ - dnf_sslcacert_opt=""; \ - if [ -s "${HOST_CA_BUNDLE}" ]; then \ - export CURL_CA_BUNDLE="${HOST_CA_BUNDLE}" \ - GIT_SSL_CAINFO="${HOST_CA_BUNDLE}" \ - PIP_CERT="${HOST_CA_BUNDLE}" \ - REQUESTS_CA_BUNDLE="${HOST_CA_BUNDLE}" \ - SSL_CERT_FILE="${HOST_CA_BUNDLE}"; \ + . "${HOST_CA_ENV}" \ + && dnf_sslcacert_opt="" \ + && if [ -s "${HOST_CA_BUNDLE}" ]; then \ dnf_sslcacert_opt="--setopt=sslcacert=${HOST_CA_BUNDLE}"; \ fi \ && dnf install -y --setopt=install_weak_deps=False ${dnf_sslcacert_opt} \ @@ -32,13 +30,7 @@ RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ # Pin CMake below 4.0 for current CLP dependency builds. Pin a recent pip so # it selects the pre-built CMake wheel instead of the source tarball. RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ - if [ -s "${HOST_CA_BUNDLE}" ]; then \ - export CURL_CA_BUNDLE="${HOST_CA_BUNDLE}" \ - GIT_SSL_CAINFO="${HOST_CA_BUNDLE}" \ - PIP_CERT="${HOST_CA_BUNDLE}" \ - REQUESTS_CA_BUNDLE="${HOST_CA_BUNDLE}" \ - SSL_CERT_FILE="${HOST_CA_BUNDLE}"; \ - fi \ + . "${HOST_CA_ENV}" \ && python3 -m pip install --no-cache-dir 'pip==21.3.1' \ && python3 -m pip install --no-cache-dir 'cmake==3.28.*' @@ -46,14 +38,8 @@ RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ ARG GO_TASK_VERSION=v3.48.0 ARG TARGETARCH RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ - set -eux; \ - if [ -s "${HOST_CA_BUNDLE}" ]; then \ - export CURL_CA_BUNDLE="${HOST_CA_BUNDLE}" \ - GIT_SSL_CAINFO="${HOST_CA_BUNDLE}" \ - PIP_CERT="${HOST_CA_BUNDLE}" \ - REQUESTS_CA_BUNDLE="${HOST_CA_BUNDLE}" \ - SSL_CERT_FILE="${HOST_CA_BUNDLE}"; \ - fi; \ + set -euxo pipefail; \ + . "${HOST_CA_ENV}"; \ mkdir -p /opt/go-task/bin; \ curl -fsSL "https://github.com/go-task/task/releases/download/${GO_TASK_VERSION}/task_linux_${TARGETARCH}.tar.gz" \ | tar xz -C /opt/go-task/bin task @@ -69,11 +55,5 @@ ENV TASK_TEMP_DIR=/opt/clp-plugin-presto-connector/.task # can reuse the installed dependencies from the image. RUN --mount=type=bind,source=.,target=/repo,readonly \ --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ - if [ -s "${HOST_CA_BUNDLE}" ]; then \ - export CURL_CA_BUNDLE="${HOST_CA_BUNDLE}" \ - GIT_SSL_CAINFO="${HOST_CA_BUNDLE}" \ - PIP_CERT="${HOST_CA_BUNDLE}" \ - REQUESTS_CA_BUNDLE="${HOST_CA_BUNDLE}" \ - SSL_CERT_FILE="${HOST_CA_BUNDLE}"; \ - fi \ + . "${HOST_CA_ENV}" \ && TASK_CONCURRENCY=1 task -d /repo velox-connector:deps:install-all diff --git a/tools/build-packages/dependency-image/use-host-ca.sh b/tools/build-packages/dependency-image/use-host-ca.sh new file mode 100644 index 00000000..5cc9a740 --- /dev/null +++ b/tools/build-packages/dependency-image/use-host-ca.sh @@ -0,0 +1,7 @@ +if [ -s "${HOST_CA_BUNDLE}" ]; then + export CURL_CA_BUNDLE="${HOST_CA_BUNDLE}" + export GIT_SSL_CAINFO="${HOST_CA_BUNDLE}" + export PIP_CERT="${HOST_CA_BUNDLE}" + export REQUESTS_CA_BUNDLE="${HOST_CA_BUNDLE}" + export SSL_CERT_FILE="${HOST_CA_BUNDLE}" +fi diff --git a/tools/build-packages/dependency-image/lib.sh b/tools/build-packages/dependency-image/utils.sh similarity index 98% rename from tools/build-packages/dependency-image/lib.sh rename to tools/build-packages/dependency-image/utils.sh index 96fa7de7..0af9d7fb 100644 --- a/tools/build-packages/dependency-image/lib.sh +++ b/tools/build-packages/dependency-image/utils.sh @@ -21,6 +21,7 @@ image_ref() { # Inputs that should change the build-env image tag. _BUILD_ENV_HASH_INPUTS=( + ".dockerignore" ".github/workflows/build-dependency-image.yaml" "taskfile.yaml" "taskfiles" @@ -34,7 +35,7 @@ _BUILD_ENV_HASH_INPUTS=( # Requires: git, sha256sum derive_build_env_hash() { ( - cd "${_REPO_ROOT}" + cd "${_REPO_ROOT}" || exit ensure_yscope_dev_utils_submodule >&2 git ls-files -z --recurse-submodules -- "${_BUILD_ENV_HASH_INPUTS[@]}" \ | sort -z \ From ff71b50a7620b033cb75994d99d23a9fd509b463 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 22:09:50 -0700 Subject: [PATCH 12/39] Update tools/build-packages/dependency-image/Dockerfile Co-authored-by: ChenXing Yang <60459812+20001020ycx@users.noreply.github.com> --- tools/build-packages/dependency-image/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index 4b9d78aa..60ffd151 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -34,7 +34,6 @@ RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ && python3 -m pip install --no-cache-dir 'pip==21.3.1' \ && python3 -m pip install --no-cache-dir 'cmake==3.28.*' -# go-task — task driver for dependency installation and CMake builds. ARG GO_TASK_VERSION=v3.48.0 ARG TARGETARCH RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ From 700fbcacf28cd8c87fbb2f9c563ce2f0e86841e5 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 22:10:01 -0700 Subject: [PATCH 13/39] Update tools/build-packages/dependency-image/Dockerfile Co-authored-by: ChenXing Yang <60459812+20001020ycx@users.noreply.github.com> --- tools/build-packages/dependency-image/Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index 60ffd151..26da3fdb 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -1,7 +1,4 @@ # syntax=docker/dockerfile:1 -# -# Build-env image for CLP Presto connector packages. -# Installs packaging tools and connector C/C++ dependencies. FROM quay.io/pypa/manylinux_2_28:latest From 6aa65933aa20756a03c9d0fbb1af39cb19307424 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 22:10:38 -0700 Subject: [PATCH 14/39] Update tools/build-packages/dependency-image/Dockerfile Co-authored-by: ChenXing Yang <60459812+20001020ycx@users.noreply.github.com> --- tools/build-packages/dependency-image/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index 26da3fdb..523b8907 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -24,8 +24,6 @@ RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ libunwind-devel ninja-build openssl-devel patchelf python3-pip rpm-build \ && dnf clean all -# Pin CMake below 4.0 for current CLP dependency builds. Pin a recent pip so -# it selects the pre-built CMake wheel instead of the source tarball. RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ . "${HOST_CA_ENV}" \ && python3 -m pip install --no-cache-dir 'pip==21.3.1' \ From bc56905de769bafcdb5495e68da052db62c1a568 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 23:14:12 -0700 Subject: [PATCH 15/39] Update tools/build-packages/dependency-image/Dockerfile Co-authored-by: ChenXing Yang <60459812+20001020ycx@users.noreply.github.com> --- tools/build-packages/dependency-image/Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index 523b8907..ec5430b7 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -43,10 +43,7 @@ ENV PATH=/opt/go-task/bin:${PATH} ENV CLP_PLUGIN_BUILD_DIR=/opt/clp-plugin-presto-connector/build ENV TASK_TEMP_DIR=/opt/clp-plugin-presto-connector/.task -# Build one dependency at a time; each dependency build still defaults to nproc. -# Bind-mount the repository as readonly build input. Dependency outputs and Task -# checksum metadata are written outside the repository mount so package builds -# can reuse the installed dependencies from the image. +# Build one dependency at a time to avoid excessive memory usage from parallel builds. RUN --mount=type=bind,source=.,target=/repo,readonly \ --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ . "${HOST_CA_ENV}" \ From c17fa2dc9dddbc448cd55f56ff17be443e3557b3 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Thu, 9 Jul 2026 23:20:41 -0700 Subject: [PATCH 16/39] Update taskfile.yaml Co-authored-by: ChenXing Yang <60459812+20001020ycx@users.noreply.github.com> --- taskfile.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/taskfile.yaml b/taskfile.yaml index eaebcefe..b6dbf50f 100644 --- a/taskfile.yaml +++ b/taskfile.yaml @@ -7,7 +7,7 @@ includes: vars: DEFAULT_CLP_PLUGIN_BUILD_DIR: "{{.ROOT_DIR}}/build" - G_BUILD_DIR: '{{default .DEFAULT_CLP_PLUGIN_BUILD_DIR (env "CLP_PLUGIN_BUILD_DIR")}}' + G_BUILD_DIR: '{{env "CLP_PLUGIN_BUILD_DIR" | default .DEFAULT_CLP_PLUGIN_BUILD_DIR}}' tasks: clean: From 52b0dcb33eaf05f6877a280d801a8e073f8d74ca Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 00:05:36 -0700 Subject: [PATCH 17/39] fix(packaging): exclude generated Docker context files --- .dockerignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.dockerignore b/.dockerignore index 6b8710a7..f98663de 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,5 @@ .git +.task +build +**/target +packages-* From 183069671c8eb439946dd3316a4601a3532a5db5 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:41:52 -0700 Subject: [PATCH 18/39] Update .github/workflows/build-dependency-image.yaml Co-authored-by: Junhao Liao --- .github/workflows/build-dependency-image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dependency-image.yaml b/.github/workflows/build-dependency-image.yaml index 3c755ffe..31f7fe27 100644 --- a/.github/workflows/build-dependency-image.yaml +++ b/.github/workflows/build-dependency-image.yaml @@ -137,7 +137,7 @@ jobs: steps: - name: "Log in to GHCR" - uses: "docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9" # v3.7.0 + uses: "docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0" # v4.4.0 with: registry: "ghcr.io" username: "${{github.actor}}" From 54b31f018fbaa843f13375d92b4422f95679f9eb Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:42:03 -0700 Subject: [PATCH 19/39] Update .github/workflows/build-dependency-image.yaml Co-authored-by: Junhao Liao --- .github/workflows/build-dependency-image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dependency-image.yaml b/.github/workflows/build-dependency-image.yaml index 31f7fe27..4f68fa46 100644 --- a/.github/workflows/build-dependency-image.yaml +++ b/.github/workflows/build-dependency-image.yaml @@ -113,7 +113,7 @@ jobs: password: "${{secrets.GITHUB_TOKEN}}" - name: "Set up Docker Buildx" - uses: "docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f" # v3.12.0 + uses: "docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c" # v4.2.0 - name: "Build per-arch dependency image" env: From 63cf47e6be5114c6d5e61678dcd010df44e17624 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:42:12 -0700 Subject: [PATCH 20/39] Update .github/workflows/build-dependency-image.yaml Co-authored-by: Junhao Liao --- .github/workflows/build-dependency-image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dependency-image.yaml b/.github/workflows/build-dependency-image.yaml index 4f68fa46..d3ba75df 100644 --- a/.github/workflows/build-dependency-image.yaml +++ b/.github/workflows/build-dependency-image.yaml @@ -106,7 +106,7 @@ jobs: - name: "Log in to GHCR" if: "github.event_name != 'pull_request'" - uses: "docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9" # v3.7.0 + uses: "docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0" # v4.4.0 with: registry: "ghcr.io" username: "${{github.actor}}" From fd3ef9fdcf071736a2c61fb4159556fe83951bce Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:42:24 -0700 Subject: [PATCH 21/39] Update .github/workflows/build-dependency-image.yaml Co-authored-by: Junhao Liao --- .github/workflows/build-dependency-image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dependency-image.yaml b/.github/workflows/build-dependency-image.yaml index d3ba75df..b06e710a 100644 --- a/.github/workflows/build-dependency-image.yaml +++ b/.github/workflows/build-dependency-image.yaml @@ -100,7 +100,7 @@ jobs: steps: - name: "Check out repository" - uses: "actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5" # v4.3.1 + uses: "actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0" # v7.0.0 with: persist-credentials: false From a283d8c31c84f297052f53b18550e05e610e5572 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:42:36 -0700 Subject: [PATCH 22/39] Update .github/workflows/build-dependency-image.yaml Co-authored-by: Junhao Liao --- .github/workflows/build-dependency-image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dependency-image.yaml b/.github/workflows/build-dependency-image.yaml index b06e710a..c0f70d48 100644 --- a/.github/workflows/build-dependency-image.yaml +++ b/.github/workflows/build-dependency-image.yaml @@ -58,7 +58,7 @@ jobs: - name: "Log in to GHCR" if: "github.event_name != 'pull_request'" - uses: "docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9" # v3.7.0 + uses: "docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0" # v4.4.0 with: registry: "ghcr.io" username: "${{github.actor}}" From 14cd655b404826579fd9f4bd646d16529f0ea91f Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:42:45 -0700 Subject: [PATCH 23/39] Update .github/workflows/build-dependency-image.yaml Co-authored-by: Junhao Liao --- .github/workflows/build-dependency-image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dependency-image.yaml b/.github/workflows/build-dependency-image.yaml index c0f70d48..dda47067 100644 --- a/.github/workflows/build-dependency-image.yaml +++ b/.github/workflows/build-dependency-image.yaml @@ -43,7 +43,7 @@ jobs: needs-build: "${{steps.decide.outputs.needs-build}}" steps: - name: "Check out repository" - uses: "actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5" # v4.3.1 + uses: "actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0" # v7.0.0 with: persist-credentials: false From 3c05f759d2e51f3f9ecef4026f13e7e5a2dd7563 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:42:55 -0700 Subject: [PATCH 24/39] Update tools/build-packages/dependency-image/utils.sh Co-authored-by: Junhao Liao --- tools/build-packages/dependency-image/utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/dependency-image/utils.sh b/tools/build-packages/dependency-image/utils.sh index 0af9d7fb..bcf49940 100644 --- a/tools/build-packages/dependency-image/utils.sh +++ b/tools/build-packages/dependency-image/utils.sh @@ -65,7 +65,7 @@ _stage_host_ca_bundle() { return 0 done - echo "==> No host CA bundle found; continuing without host CA context." >&2 + echo >&2 "==> No host CA bundle found; continuing without host CA context." return 1 } From 6a0466759c9576aaadfaec8f1ae6e80135ec57c1 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:43:34 -0700 Subject: [PATCH 25/39] Update tools/build-packages/dependency-image/utils.sh Co-authored-by: Junhao Liao --- tools/build-packages/dependency-image/utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/dependency-image/utils.sh b/tools/build-packages/dependency-image/utils.sh index bcf49940..ad7fc80b 100644 --- a/tools/build-packages/dependency-image/utils.sh +++ b/tools/build-packages/dependency-image/utils.sh @@ -60,7 +60,7 @@ _stage_host_ca_bundle() { local src for src in "${ca_bundle_candidates[@]}"; do [[ -f "${src}" && -s "${src}" ]] || continue - echo "==> Staging host CA bundle: ${src} -> ${dest}" >&2 + echo >&2 "==> Staging host CA bundle: ${src} -> ${dest}" cp "${src}" "${dest}" return 0 done From 93a8273fe3aa2af22828502c6ddf17ec3c2e4c59 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:44:07 -0700 Subject: [PATCH 26/39] Update tools/build-packages/build-dependency-image.sh Co-authored-by: Junhao Liao --- tools/build-packages/build-dependency-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh index f62e29d3..ad8325c6 100755 --- a/tools/build-packages/build-dependency-image.sh +++ b/tools/build-packages/build-dependency-image.sh @@ -75,7 +75,7 @@ main() { echo "==> Image not available — building from scratch..." >&2 build_image "${image}" "${platform}" "--load" - echo "==> Built locally." >&2 + echo >&2 "==> Built locally." echo "${image}" } From 321c316423e846157ba635221e4df06b67843bbc Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:44:19 -0700 Subject: [PATCH 27/39] Update tools/build-packages/build-dependency-image.sh Co-authored-by: Junhao Liao --- tools/build-packages/build-dependency-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh index ad8325c6..be111f90 100755 --- a/tools/build-packages/build-dependency-image.sh +++ b/tools/build-packages/build-dependency-image.sh @@ -73,7 +73,7 @@ main() { echo " docker pull failed; will build from scratch. Pull error:" >&2 printf '%s\n' "${pull_err}" | sed 's/^/ /' >&2 - echo "==> Image not available — building from scratch..." >&2 + echo >&2 "==> Image not available — building from scratch..." build_image "${image}" "${platform}" "--load" echo >&2 "==> Built locally." echo "${image}" From 7965baa281934882fff019e1239a3bd458840a7c Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:44:32 -0700 Subject: [PATCH 28/39] Update tools/build-packages/build-dependency-image.sh Co-authored-by: Junhao Liao --- tools/build-packages/build-dependency-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh index be111f90..57036d4e 100755 --- a/tools/build-packages/build-dependency-image.sh +++ b/tools/build-packages/build-dependency-image.sh @@ -70,7 +70,7 @@ main() { return fi - echo " docker pull failed; will build from scratch. Pull error:" >&2 + echo >&2 " docker pull failed; will build from scratch. Pull error:" printf '%s\n' "${pull_err}" | sed 's/^/ /' >&2 echo >&2 "==> Image not available — building from scratch..." From 5f72b86998b5d08721d0add4e5d26162e376cfde Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:44:44 -0700 Subject: [PATCH 29/39] Update tools/build-packages/build-dependency-image.sh Co-authored-by: Junhao Liao --- tools/build-packages/build-dependency-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh index 57036d4e..701d8876 100755 --- a/tools/build-packages/build-dependency-image.sh +++ b/tools/build-packages/build-dependency-image.sh @@ -58,7 +58,7 @@ main() { echo " image: ${image}" >&2 if docker image inspect "${image}" &>/dev/null; then - echo "==> Found in local Docker cache." >&2 + echo >&2 "==> Found in local Docker cache." echo "${image}" return fi From 8fbbbf6be5c4048a44387716d73dcd648592285d Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:44:59 -0700 Subject: [PATCH 30/39] Update tools/build-packages/build-dependency-image.sh Co-authored-by: Junhao Liao --- tools/build-packages/build-dependency-image.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh index 701d8876..90612eb1 100755 --- a/tools/build-packages/build-dependency-image.sh +++ b/tools/build-packages/build-dependency-image.sh @@ -54,8 +54,8 @@ main() { image="$(image_ref "${image_repo}" "build-env" "${build_env_hash}")" platform="$(host_platform)" - echo " build-env hash: ${build_env_hash}" >&2 - echo " image: ${image}" >&2 + echo >&2 " build-env hash: ${build_env_hash}" + echo >&2 " image: ${image}" if docker image inspect "${image}" &>/dev/null; then echo >&2 "==> Found in local Docker cache." From 561f33d87bcfffc9c10e367aac9f08a7b454da33 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:45:23 -0700 Subject: [PATCH 31/39] Update tools/build-packages/build-dependency-image.sh Co-authored-by: Junhao Liao --- tools/build-packages/build-dependency-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh index 90612eb1..9a844265 100755 --- a/tools/build-packages/build-dependency-image.sh +++ b/tools/build-packages/build-dependency-image.sh @@ -48,7 +48,7 @@ host_platform() { main() { local build_env_hash image image_repo platform pull_err - echo "==> Deriving build-env hash..." >&2 + echo >&2 "==> Deriving build-env hash..." build_env_hash="$(derive_build_env_hash)" image_repo="$(image_repo_from_origin)" image="$(image_ref "${image_repo}" "build-env" "${build_env_hash}")" From c0676560ca66dd0a6160d8cac7e3869811fbd4ce Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:45:30 -0700 Subject: [PATCH 32/39] Update tools/build-packages/build-dependency-image.sh Co-authored-by: Junhao Liao --- tools/build-packages/build-dependency-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh index 9a844265..cf0353d2 100755 --- a/tools/build-packages/build-dependency-image.sh +++ b/tools/build-packages/build-dependency-image.sh @@ -41,7 +41,7 @@ host_platform() { case "$(uname -m)" in x86_64) printf 'linux/amd64\n' ;; aarch64|arm64) printf 'linux/arm64\n' ;; - *) echo "ERROR: unsupported host arch: $(uname -m)" >&2; exit 1 ;; + *) echo >&2 "ERROR: unsupported host arch: $(uname -m)"; exit 1 ;; esac } From e6a31f2a5217400af12631308f30cda3e5a606d6 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:45:42 -0700 Subject: [PATCH 33/39] Update tools/build-packages/build-dependency-image.sh Co-authored-by: Junhao Liao --- tools/build-packages/build-dependency-image.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh index cf0353d2..281ae895 100755 --- a/tools/build-packages/build-dependency-image.sh +++ b/tools/build-packages/build-dependency-image.sh @@ -28,8 +28,8 @@ image_repo_from_origin() { git@github.com:*) owner_repo="${remote_url#git@github.com:}" ;; ssh://git@github.com/*) owner_repo="${remote_url#ssh://git@github.com/}" ;; *) - echo "ERROR: can't derive GHCR image repo from origin remote: ${remote_url}" >&2 - echo " Expected a github.com remote." >&2 + echo >&2 "ERROR: can't derive GHCR image repo from origin remote: ${remote_url}" + echo >&2 " Expected a github.com remote." exit 1 ;; esac From e64f0ddf5a383ec2a3e4f2f937962982d7994e7b Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:46:12 -0700 Subject: [PATCH 34/39] Update .github/workflows/build-dependency-image.yaml Co-authored-by: Junhao Liao --- .github/workflows/build-dependency-image.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-dependency-image.yaml b/.github/workflows/build-dependency-image.yaml index dda47067..a2e0d058 100644 --- a/.github/workflows/build-dependency-image.yaml +++ b/.github/workflows/build-dependency-image.yaml @@ -11,6 +11,7 @@ name: "build-dependency-image" on: pull_request: paths: + - ".dockerignore" - ".github/workflows/build-dependency-image.yaml" - "taskfile.yaml" - "taskfiles/**" From 7df79ed7071f5d279601b5001e63501ab6fae783 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:46:35 -0700 Subject: [PATCH 35/39] Update tools/build-packages/dependency-image/utils.sh Co-authored-by: Junhao Liao --- tools/build-packages/dependency-image/utils.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/build-packages/dependency-image/utils.sh b/tools/build-packages/dependency-image/utils.sh index ad7fc80b..7916b7c2 100644 --- a/tools/build-packages/dependency-image/utils.sh +++ b/tools/build-packages/dependency-image/utils.sh @@ -61,7 +61,10 @@ _stage_host_ca_bundle() { for src in "${ca_bundle_candidates[@]}"; do [[ -f "${src}" && -s "${src}" ]] || continue echo >&2 "==> Staging host CA bundle: ${src} -> ${dest}" - cp "${src}" "${dest}" + if ! cp "${src}" "${dest}"; then + echo >&2 "ERROR: failed to stage host CA bundle: ${src}" + return 1 + fi return 0 done From 979c33463ae2a59229eb20ec2dfaaef537552e39 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 13:52:31 -0700 Subject: [PATCH 36/39] Update tools/build-packages/dependency-image/utils.sh Co-authored-by: Junhao Liao --- tools/build-packages/dependency-image/utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/dependency-image/utils.sh b/tools/build-packages/dependency-image/utils.sh index 7916b7c2..34230572 100644 --- a/tools/build-packages/dependency-image/utils.sh +++ b/tools/build-packages/dependency-image/utils.sh @@ -38,7 +38,7 @@ derive_build_env_hash() { cd "${_REPO_ROOT}" || exit ensure_yscope_dev_utils_submodule >&2 git ls-files -z --recurse-submodules -- "${_BUILD_ENV_HASH_INPUTS[@]}" \ - | sort -z \ + | LC_ALL=C sort -z \ | xargs -0 sha256sum \ | sha256sum \ | cut -c1-16 From 822afca11a3856b213e0d5cedc02ee1d7706b8b8 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 15:08:05 -0700 Subject: [PATCH 37/39] refactor(packaging): Set Task concurrency via CLI --- tools/build-packages/dependency-image/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/dependency-image/Dockerfile b/tools/build-packages/dependency-image/Dockerfile index ec5430b7..b08cec20 100644 --- a/tools/build-packages/dependency-image/Dockerfile +++ b/tools/build-packages/dependency-image/Dockerfile @@ -47,4 +47,4 @@ ENV TASK_TEMP_DIR=/opt/clp-plugin-presto-connector/.task RUN --mount=type=bind,source=.,target=/repo,readonly \ --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \ . "${HOST_CA_ENV}" \ - && TASK_CONCURRENCY=1 task -d /repo velox-connector:deps:install-all + && task --concurrency 1 -d /repo velox-connector:deps:install-all From ad18a2831b3cefa76195b0790904f751ff3227c6 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 15:44:35 -0700 Subject: [PATCH 38/39] Apply suggestion from @junhaoliao Co-authored-by: Junhao Liao --- tools/build-packages/build-dependency-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh index 281ae895..642f93de 100755 --- a/tools/build-packages/build-dependency-image.sh +++ b/tools/build-packages/build-dependency-image.sh @@ -63,7 +63,7 @@ main() { return fi - echo "==> Checking repository registry..." >&2 + echo >&2 "==> Checking repository registry..." if pull_err="$(docker pull "${image}" 2>&1)"; then echo "==> Pulled from repository registry." >&2 echo "${image}" From 39cbbe43fb87693286e60943b22ef31888d9e993 Mon Sep 17 00:00:00 2001 From: Jack Luo Date: Fri, 10 Jul 2026 15:45:18 -0700 Subject: [PATCH 39/39] Apply suggestions from code review Co-authored-by: Junhao Liao --- tools/build-packages/build-dependency-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-packages/build-dependency-image.sh b/tools/build-packages/build-dependency-image.sh index 642f93de..4c73c465 100755 --- a/tools/build-packages/build-dependency-image.sh +++ b/tools/build-packages/build-dependency-image.sh @@ -65,7 +65,7 @@ main() { echo >&2 "==> Checking repository registry..." if pull_err="$(docker pull "${image}" 2>&1)"; then - echo "==> Pulled from repository registry." >&2 + echo >&2 "==> Pulled from repository registry." echo "${image}" return fi