Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
bb0bff0
feat(packaging): Add a manylinux-based build-env image and CI to publ…
jackluo923 Jul 8, 2026
a2c3d14
ci(packaging): Validate build-env image on pull requests
jackluo923 Jul 9, 2026
fa12a14
refactor(packaging): Use repository root as build-env context
jackluo923 Jul 9, 2026
5ebfec7
refactor(packaging): Simplify build-env helper paths
jackluo923 Jul 9, 2026
378bb46
refactor(packaging): Simplify build-env Dockerfile
jackluo923 Jul 9, 2026
c86c415
refactor(packaging): Mount repository during build-env setup
jackluo923 Jul 9, 2026
0fb6a98
fix(packaging): Preserve build-env task metadata
jackluo923 Jul 9, 2026
da06102
refactor(packaging): Scope CA bundle handling to build-env
jackluo923 Jul 9, 2026
a087bcd
fix(packaging): Support corporate CA bundles larger than BuildKit's s…
jackluo923 Jul 9, 2026
14c3e7d
fix(packaging): Simplify host CA staging
jackluo923 Jul 9, 2026
200831a
fix(packaging): Harden build-env image context
jackluo923 Jul 9, 2026
ff71b50
Update tools/build-packages/dependency-image/Dockerfile
jackluo923 Jul 10, 2026
700fbca
Update tools/build-packages/dependency-image/Dockerfile
jackluo923 Jul 10, 2026
6aa6593
Update tools/build-packages/dependency-image/Dockerfile
jackluo923 Jul 10, 2026
bc56905
Update tools/build-packages/dependency-image/Dockerfile
jackluo923 Jul 10, 2026
c17fa2d
Update taskfile.yaml
jackluo923 Jul 10, 2026
52b0dcb
fix(packaging): exclude generated Docker context files
jackluo923 Jul 10, 2026
1830696
Update .github/workflows/build-dependency-image.yaml
jackluo923 Jul 10, 2026
54b31f0
Update .github/workflows/build-dependency-image.yaml
jackluo923 Jul 10, 2026
63cf47e
Update .github/workflows/build-dependency-image.yaml
jackluo923 Jul 10, 2026
fd3ef9f
Update .github/workflows/build-dependency-image.yaml
jackluo923 Jul 10, 2026
a283d8c
Update .github/workflows/build-dependency-image.yaml
jackluo923 Jul 10, 2026
14cd655
Update .github/workflows/build-dependency-image.yaml
jackluo923 Jul 10, 2026
3c05f75
Update tools/build-packages/dependency-image/utils.sh
jackluo923 Jul 10, 2026
6a04667
Update tools/build-packages/dependency-image/utils.sh
jackluo923 Jul 10, 2026
93a8273
Update tools/build-packages/build-dependency-image.sh
jackluo923 Jul 10, 2026
321c316
Update tools/build-packages/build-dependency-image.sh
jackluo923 Jul 10, 2026
7965baa
Update tools/build-packages/build-dependency-image.sh
jackluo923 Jul 10, 2026
5f72b86
Update tools/build-packages/build-dependency-image.sh
jackluo923 Jul 10, 2026
8fbbbf6
Update tools/build-packages/build-dependency-image.sh
jackluo923 Jul 10, 2026
561f33d
Update tools/build-packages/build-dependency-image.sh
jackluo923 Jul 10, 2026
c067656
Update tools/build-packages/build-dependency-image.sh
jackluo923 Jul 10, 2026
e6a31f2
Update tools/build-packages/build-dependency-image.sh
jackluo923 Jul 10, 2026
e64f0dd
Update .github/workflows/build-dependency-image.yaml
jackluo923 Jul 10, 2026
7df79ed
Update tools/build-packages/dependency-image/utils.sh
jackluo923 Jul 10, 2026
979c334
Update tools/build-packages/dependency-image/utils.sh
jackluo923 Jul 10, 2026
822afca
refactor(packaging): Set Task concurrency via CLI
jackluo923 Jul 10, 2026
ad18a28
Apply suggestion from @junhaoliao
jackluo923 Jul 10, 2026
39cbbe4
Apply suggestions from code review
jackluo923 Jul 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
.task
build
**/target
packages-*
153 changes: 153 additions & 0 deletions .github/workflows/build-dependency-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# 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-<hash> image reference and decide whether to build
# build validate or publish per-architecture images
# manifest publish the multi-architecture env-<hash> tag

name: "build-dependency-image"

on:
pull_request:
paths:
- ".github/workflows/build-dependency-image.yaml"
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
- "taskfile.yaml"
- "taskfiles/**"
- "tools/build-packages/build-dependency-image.sh"
- "tools/build-packages/dependency-image/**"
- "tools/yscope-dev-utils"
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"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

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
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
with:
persist-credentials: false

- name: "Resolve dependency image"
id: "image"
run: |-
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}")
echo "ref=${image}" >> "$GITHUB_OUTPUT"

- name: "Log in to GHCR"
if: "github.event_name != 'pull_request'"
uses: "docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9" # v3.7.0
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
with:
registry: "ghcr.io"
username: "${{github.actor}}"
password: "${{secrets.GITHUB_TOKEN}}"

- name: "Decide whether to build"
id: "decide"
env:
IMAGE: "${{steps.image.outputs.ref}}"
run: |-
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
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
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
with:
persist-credentials: false

- name: "Log in to GHCR"
if: "github.event_name != 'pull_request'"
uses: "docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9" # v3.7.0
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
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
Comment thread
jackluo923 marked this conversation as resolved.
Resolved

- name: "Build per-arch dependency image"
env:
IMAGE: "${{needs.plan.outputs.image}}"
ARCH: "${{matrix.arch}}"
run: |-
source tools/build-packages/dependency-image/utils.sh
output="--push"
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
output="--load"
fi
build_image "${IMAGE}-${ARCH}" "linux/${ARCH}" "${output}"

manifest:
needs: ["plan", "build"]
if: "github.event_name != 'pull_request' && 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
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
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"
3 changes: 2 additions & 1 deletion taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ includes:
velox-connector: "taskfiles/velox-connector/main.yaml"

vars:
G_BUILD_DIR: "{{.ROOT_DIR}}/build"
DEFAULT_CLP_PLUGIN_BUILD_DIR: "{{.ROOT_DIR}}/build"
G_BUILD_DIR: '{{env "CLP_PLUGIN_BUILD_DIR" | default .DEFAULT_CLP_PLUGIN_BUILD_DIR}}'

tasks:
clean:
Expand Down
1 change: 0 additions & 1 deletion taskfiles/velox-connector/deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ tasks:
- task: "yscope-dev-utils:cmake:build"
vars:
BUILD_DIR: "{{.BUILD_DIR}}"
JOBS: "{{.G_CPP_MAX_PARALLELISM_PER_BUILD_TASK}}"
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
- task: "yscope-dev-utils:cmake:install"
vars:
BUILD_DIR: "{{.BUILD_DIR}}"
Expand Down
82 changes: 82 additions & 0 deletions tools/build-packages/build-dependency-image.sh
Original file line number Diff line number Diff line change
@@ -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/utils.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
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
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 ;;
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
esac
}

main() {
local build_env_hash image image_repo platform pull_err

echo "==> Deriving build-env hash..." >&2
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
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
Comment thread
jackluo923 marked this conversation as resolved.
Resolved

if docker image inspect "${image}" &>/dev/null; then
echo "==> Found in local Docker cache." >&2
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
echo "${image}"
return
fi

echo "==> Checking repository registry..." >&2
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
if pull_err="$(docker pull "${image}" 2>&1)"; then
echo "==> Pulled from repository registry." >&2
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
echo "${image}"
return
fi

echo " docker pull failed; will build from scratch. Pull error:" >&2
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
printf '%s\n' "${pull_err}" | sed 's/^/ /' >&2

echo "==> Image not available — building from scratch..." >&2
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
build_image "${image}" "${platform}" "--load"
echo "==> Built locally." >&2
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
echo "${image}"
}

main
50 changes: 50 additions & 0 deletions tools/build-packages/dependency-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# syntax=docker/dockerfile:1

FROM quay.io/pypa/manylinux_2_28:latest
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

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} \
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
. "${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} \
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

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' \
&& python3 -m pip install --no-cache-dir 'cmake==3.28.*'

ARG GO_TASK_VERSION=v3.48.0
ARG TARGETARCH
RUN --mount=type=bind,from=host-ca,source=host-ca,target=${HOST_CA_BUNDLE} \
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
Comment thread
jackluo923 marked this conversation as resolved.
Resolved

ENV PATH=/opt/go-task/bin:${PATH}

ENV CLP_PLUGIN_BUILD_DIR=/opt/clp-plugin-presto-connector/build
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
ENV TASK_TEMP_DIR=/opt/clp-plugin-presto-connector/.task
Comment thread
jackluo923 marked this conversation as resolved.
Resolved

# 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}" \
&& TASK_CONCURRENCY=1 task -d /repo velox-connector:deps:install-all
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
7 changes: 7 additions & 0 deletions tools/build-packages/dependency-image/use-host-ca.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
if [ -s "${HOST_CA_BUNDLE}" ]; then
Comment thread
jackluo923 marked this conversation as resolved.
Resolved
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
Loading
Loading