Skip to content

Commit 3f13a7b

Browse files
authored
fix(ci): derive Docker boundary version from package (#7248)
1 parent 51e5825 commit 3f13a7b

5 files changed

Lines changed: 41 additions & 23 deletions

File tree

.github/workflows/docker-release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ jobs:
4646
with:
4747
submodules: recursive
4848

49+
- name: Get QwenPaw version
50+
id: qwenpaw_version
51+
uses: ./.github/actions/get-version
52+
4953
- name: Set up Docker Buildx
5054
uses: docker/setup-buildx-action@v3
5155

@@ -91,6 +95,7 @@ jobs:
9195
VERSION: ${{ steps.vars.outputs.version }}
9296
IS_PRERELEASE: ${{ steps.vars.outputs.is_prerelease }}
9397
QWENPAW_DISABLED_CHANNELS: "imessage"
98+
QWENPAW_VERSION: ${{ steps.qwenpaw_version.outputs.version }}
9499
run: |
95100
TAGS="-t ${ACR_REGISTRY}/${IMAGE}:${VERSION} -t ${ACR_REGISTRY}/${IMAGE}:pre"
96101
TAGS="${TAGS} -t docker.io/${IMAGE}:${VERSION} -t docker.io/${IMAGE}:pre"
@@ -100,4 +105,6 @@ jobs:
100105
docker buildx build --platform linux/amd64,linux/arm64 \
101106
-f deploy/Dockerfile \
102107
--build-arg QWENPAW_DISABLED_CHANNELS="${QWENPAW_DISABLED_CHANNELS}" \
108+
--build-arg \
109+
QWENPAW_MANAGED_RUNTIME_BOUNDARY_VERSION="${QWENPAW_VERSION}" \
103110
${TAGS} --push .

.github/workflows/release-verify.yml

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -173,28 +173,9 @@ jobs:
173173
with:
174174
ref: ${{ inputs.ref }}
175175

176-
- name: Verify managed runtime boundary version
177-
shell: bash
178-
run: |
179-
python - <<'PY'
180-
import re
181-
from pathlib import Path
182-
183-
version_source = Path("src/qwenpaw/__version__.py").read_text()
184-
dockerfile = Path("deploy/Dockerfile").read_text()
185-
version = re.search(r'__version__ = "([^"]+)"', version_source)
186-
boundary = re.search(
187-
r'ARG QWENPAW_MANAGED_RUNTIME_BOUNDARY_VERSION="([^"]+)"',
188-
dockerfile,
189-
)
190-
if version is None or boundary is None:
191-
raise SystemExit("Unable to read runtime boundary versions")
192-
if version.group(1) != boundary.group(1):
193-
raise SystemExit(
194-
f"Runtime boundary version mismatch: "
195-
f"{boundary.group(1)} != {version.group(1)}",
196-
)
197-
PY
176+
- name: Get QwenPaw version
177+
id: version
178+
uses: ./.github/actions/get-version
198179

199180
- name: Log in to Aliyun ACR (when credentials available)
200181
if: env.ACR_USERNAME != ''
@@ -210,6 +191,7 @@ jobs:
210191
env:
211192
DOCKER_NODE_IMAGE: ${{ inputs.docker_node_image }}
212193
DOCKER_UV_IMAGE: ${{ inputs.docker_uv_image }}
194+
QWENPAW_VERSION: ${{ steps.version.outputs.version }}
213195
run: |
214196
BUILD_ARGS=""
215197
if [ -n "$DOCKER_NODE_IMAGE" ]; then
@@ -221,9 +203,22 @@ jobs:
221203
docker build \
222204
-f deploy/Dockerfile \
223205
-t qwenpaw-verify:test \
206+
--build-arg \
207+
QWENPAW_MANAGED_RUNTIME_BOUNDARY_VERSION="$QWENPAW_VERSION" \
224208
$BUILD_ARGS \
225209
.
226210
211+
- name: Verify managed runtime boundary version
212+
env:
213+
QWENPAW_VERSION: ${{ steps.version.outputs.version }}
214+
run: |
215+
actual=$(docker image inspect qwenpaw-verify:test \
216+
--format '{{ index .Config.Labels "io.qwenpaw.managed-runtime-boundary.version" }}')
217+
if [ "$actual" != "$QWENPAW_VERSION" ]; then
218+
echo "::error::Runtime boundary version mismatch: $actual != $QWENPAW_VERSION"
219+
exit 1
220+
fi
221+
227222
- name: Start container
228223
run: |
229224
docker run -d \

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,10 @@ jobs:
266266
ref: ${{ needs.resolve.outputs.sha }}
267267
submodules: recursive
268268

269+
- name: Get QwenPaw version
270+
id: version
271+
uses: ./.github/actions/get-version
272+
269273
- name: Set up QEMU
270274
uses: docker/setup-qemu-action@v3
271275

@@ -285,6 +289,7 @@ jobs:
285289
DOCKER_NODE_IMAGE: ${{ inputs.dry_run && 'node:20-slim' || '' }}
286290
DOCKER_UV_IMAGE: ${{ inputs.dry_run && 'ghcr.io/astral-sh/uv:latest' || '' }}
287291
QWENPAW_DISABLED_CHANNELS: "imessage"
292+
QWENPAW_VERSION: ${{ steps.version.outputs.version }}
288293
run: |
289294
BUILD_ARGS=()
290295
if [ -n "${DOCKER_NODE_IMAGE}" ]; then
@@ -296,6 +301,8 @@ jobs:
296301
docker buildx build --platform linux/amd64,linux/arm64 \
297302
-f deploy/Dockerfile \
298303
--build-arg QWENPAW_DISABLED_CHANNELS="${QWENPAW_DISABLED_CHANNELS}" \
304+
--build-arg \
305+
QWENPAW_MANAGED_RUNTIME_BOUNDARY_VERSION="${QWENPAW_VERSION}" \
299306
--output "type=oci,dest=${RUNNER_TEMP}/qwenpaw-image.tar" \
300307
"${BUILD_ARGS[@]}" .
301308

deploy/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ FROM ${UV_IMAGE} AS uv-src
1818
# -----------------------------------------------------------------------------
1919
FROM ${NODE_IMAGE}
2020

21-
ARG QWENPAW_MANAGED_RUNTIME_BOUNDARY_VERSION="2.1.1b1"
21+
ARG QWENPAW_MANAGED_RUNTIME_BOUNDARY_VERSION
2222
LABEL io.qwenpaw.managed-runtime-boundary.version=\
2323
${QWENPAW_MANAGED_RUNTIME_BOUNDARY_VERSION}
2424

scripts/docker_build.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,19 @@ shift || true
1919

2020
# Channels to exclude from the image (default: imessage).
2121
DISABLED_CHANNELS="${QWENPAW_DISABLED_CHANNELS:-imessage}"
22+
QWENPAW_VERSION=$(sed -n \
23+
's/^__version__[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' \
24+
src/qwenpaw/__version__.py)
25+
if [ -z "$QWENPAW_VERSION" ]; then
26+
echo "[docker_build] Failed to read src/qwenpaw/__version__.py" >&2
27+
exit 1
28+
fi
2229

2330
echo "[docker_build] Building image: $TAG (Dockerfile: $DOCKERFILE)"
2431
docker build -f "$DOCKERFILE" \
2532
--build-arg QWENPAW_DISABLED_CHANNELS="$DISABLED_CHANNELS" \
33+
--build-arg \
34+
QWENPAW_MANAGED_RUNTIME_BOUNDARY_VERSION="$QWENPAW_VERSION" \
2635
${QWENPAW_ENABLED_CHANNELS:+--build-arg QWENPAW_ENABLED_CHANNELS="$QWENPAW_ENABLED_CHANNELS"} \
2736
-t "$TAG" "$@" .
2837
echo "[docker_build] Done."

0 commit comments

Comments
 (0)