Skip to content

Commit e09f891

Browse files
tsafinclaude
andcommitted
CI: use branch-specific Docker image tags with fallback to :latest
docker-images.yml: - Add type=ref,event=branch so every docker build also publishes a stable branch tag (e.g. tsafin-lance_stream) alongside the SHA-pinned tag. :latest is still only pushed on the default branch (master). ci.yml: - Add resolve-images job that sanitizes the current branch name, checks whether a branch-specific image exists in GHCR (docker manifest inspect), and outputs the correct image tag per config (base/orc/lance). Falls back to :latest when no branch-specific image is available. - build-matrix, benchmark-suite, optimization-benchmarks all now use needs.resolve-images.outputs.{base,orc,lance}_image instead of :latest. This fixes CI builds on PR branches where third_party/lance-ffi has changed: the branch image contains the freshly compiled liblance_ffi.a while :latest still carries the master version with potentially missing FFI symbols. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent be72ab1 commit e09f891

2 files changed

Lines changed: 51 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,55 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
jobs:
19+
# Resolve the best available Docker image tag for each config.
20+
# Prefers a branch-specific tag (e.g. tsafin-lance_stream) over :latest so
21+
# that PRs with updated lance-ffi/third_party sources automatically use the
22+
# matching pre-compiled image built by the docker-images workflow.
23+
resolve-images:
24+
name: Resolve Docker image tags
25+
runs-on: ubuntu-22.04
26+
outputs:
27+
base_image: ${{ steps.resolve.outputs.base_image }}
28+
orc_image: ${{ steps.resolve.outputs.orc_image }}
29+
lance_image: ${{ steps.resolve.outputs.lance_image }}
30+
steps:
31+
- name: Log in to GitHub Container Registry
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Resolve image tags
39+
id: resolve
40+
run: |
41+
IMAGE_PREFIX="ghcr.io/${{ github.repository_owner }}/tpch-cpp"
42+
# Sanitize branch name the same way docker/metadata-action does:
43+
# replace / and non-alphanumeric with -, lowercase, trim leading -
44+
BRANCH="${{ github.head_ref || github.ref_name }}"
45+
BRANCH_TAG=$(echo "$BRANCH" | tr '/' '-' | tr -cs 'a-zA-Z0-9-' '-' | sed 's/^-*//' | tr '[:upper:]' '[:lower:]')
46+
echo "Branch: $BRANCH → tag: $BRANCH_TAG"
47+
48+
for CONFIG in base orc lance; do
49+
BRANCH_IMAGE="${IMAGE_PREFIX}-${CONFIG}:${BRANCH_TAG}"
50+
LATEST_IMAGE="${IMAGE_PREFIX}-${CONFIG}:latest"
51+
# Try to pull the branch-specific image; fall back to :latest
52+
if docker manifest inspect "$BRANCH_IMAGE" > /dev/null 2>&1; then
53+
echo "Using branch image: $BRANCH_IMAGE"
54+
echo "${CONFIG}_image=$BRANCH_IMAGE" >> $GITHUB_OUTPUT
55+
else
56+
echo "Branch image not found, falling back to: $LATEST_IMAGE"
57+
echo "${CONFIG}_image=$LATEST_IMAGE" >> $GITHUB_OUTPUT
58+
fi
59+
done
60+
1961
build-matrix:
2062
name: Build (${{ matrix.config }})
2163
runs-on: ubuntu-22.04
64+
needs: resolve-images
2265
timeout-minutes: 20
2366
container:
24-
image: ghcr.io/${{ github.repository_owner }}/tpch-cpp-${{ matrix.config }}:latest
67+
image: ${{ matrix.config == 'base' && needs.resolve-images.outputs.base_image || matrix.config == 'orc' && needs.resolve-images.outputs.orc_image || needs.resolve-images.outputs.lance_image }}
2568
options: --user root
2669
credentials:
2770
username: ${{ github.actor }}
@@ -140,10 +183,10 @@ jobs:
140183
benchmark-suite:
141184
name: Benchmark Suite
142185
runs-on: ubuntu-22.04
143-
needs: build-matrix
186+
needs: [resolve-images, build-matrix]
144187
timeout-minutes: 20
145188
container:
146-
image: ghcr.io/${{ github.repository_owner }}/tpch-cpp-${{ matrix.build }}:latest
189+
image: ${{ matrix.build == 'base' && needs.resolve-images.outputs.base_image || matrix.build == 'orc' && needs.resolve-images.outputs.orc_image || needs.resolve-images.outputs.lance_image }}
147190
options: --user root
148191
credentials:
149192
username: ${{ github.actor }}
@@ -295,10 +338,10 @@ jobs:
295338
optimization-benchmarks:
296339
name: Optimization Benchmarks (${{ matrix.format }}-${{ matrix.mode }})
297340
runs-on: ubuntu-22.04
298-
needs: build-matrix
341+
needs: [resolve-images, build-matrix]
299342
timeout-minutes: 20
300343
container:
301-
image: ghcr.io/${{ github.repository_owner }}/tpch-cpp-${{ matrix.image }}:latest
344+
image: ${{ matrix.image == 'base' && needs.resolve-images.outputs.base_image || matrix.image == 'orc' && needs.resolve-images.outputs.orc_image || needs.resolve-images.outputs.lance_image }}
302345
options: --user root
303346
credentials:
304347
username: ${{ github.actor }}

.github/workflows/docker-images.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ jobs:
103103
images: ${{ env.IMAGE_PREFIX }}-base
104104
tags: |
105105
type=raw,value=latest,enable={{is_default_branch}}
106+
type=ref,event=branch
106107
type=sha,prefix={{branch}}-
107108
108109
- name: Build and push base image
@@ -159,6 +160,7 @@ jobs:
159160
images: ${{ env.IMAGE_PREFIX }}-orc
160161
tags: |
161162
type=raw,value=latest,enable={{is_default_branch}}
163+
type=ref,event=branch
162164
type=sha,prefix={{branch}}-
163165
164166
- name: Build and push ORC image
@@ -216,6 +218,7 @@ jobs:
216218
images: ${{ env.IMAGE_PREFIX }}-lance
217219
tags: |
218220
type=raw,value=latest,enable={{is_default_branch}}
221+
type=ref,event=branch
219222
type=sha,prefix={{branch}}-
220223
221224
- name: Build and push Lance image

0 commit comments

Comments
 (0)