Skip to content

Commit 95d9633

Browse files
committed
ci: fix cached TKE build execution
1 parent 046a373 commit 95d9633

3 files changed

Lines changed: 30 additions & 10 deletions

File tree

.github/workflows/build-mo.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,15 @@ jobs:
135135
legacy=$(printf "schema=1\nos=%s\narch=%s\nthirdparties_tree=%s" \
136136
"$(uname -s)" "$(uname -m)" "$(git rev-parse HEAD:thirdparties)")
137137
printf '%s\n' "${legacy}" > /tmp/legacy-thirdparties.fingerprint
138-
# Accept the old schema during rollout so the first MatrixOne
139-
# commit with the new helper can still use the last builder
140-
# image; new images always use the exact schema-2 contract.
138+
echo "Computed CI builder fingerprint:"
139+
cat /tmp/expected-thirdparties.fingerprint
140+
if [ -r /mo-prebuilt/thirdparties.fingerprint ]; then
141+
echo "Cached CI builder fingerprint:"
142+
cat /mo-prebuilt/thirdparties.fingerprint
143+
fi
144+
# Accept only the pre-helper schema-1 metadata during rollout;
145+
# the schema-3 contract covers the complete native input tree,
146+
# while older partial fingerprints must rebuild safely.
141147
if cmp -s /tmp/expected-thirdparties.fingerprint /mo-prebuilt/thirdparties.fingerprint 2>/dev/null \
142148
|| cmp -s /tmp/legacy-thirdparties.fingerprint /mo-prebuilt/thirdparties.fingerprint 2>/dev/null; then
143149
rm -rf thirdparties/install

.github/workflows/image-build.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,10 @@ jobs:
214214
# arm64 SCA job is served by its own actions/cache pipeline (see
215215
# matrixorigin/matrixone sca-go-module-cache.yaml), so only amd64 is
216216
# published. Skipped for release tags so the caches always track the
217-
# default branch, and skipped gracefully on branches that do not ship
218-
# the Dockerfile yet.
217+
# default branch. Non-main refs run only the cheap presence gate and
218+
# report why publication is skipped.
219219
name: Build CI builder image
220-
if: ${{ github.event_name != 'release' && github.ref == 'refs/heads/main' }}
220+
if: ${{ github.event_name != 'release' }}
221221
# Best-effort: a builder-image problem must not turn the nightly product
222222
# image pipeline red; consumers fall back to cold builds until the next
223223
# successful publish.
@@ -236,7 +236,10 @@ jobs:
236236
- name: Check Dockerfile presence
237237
id: gate
238238
run: |
239-
if [ -f optools/images/Dockerfile.ci-builder ]; then
239+
if [ "${GITHUB_REF}" != "refs/heads/main" ]; then
240+
echo "::notice::ci-builder publication is restricted to refs/heads/main; ref=${GITHUB_REF}; skipping"
241+
echo "present=false" >> "$GITHUB_OUTPUT"
242+
elif [ -f optools/images/Dockerfile.ci-builder ]; then
240243
echo "present=true" >> "$GITHUB_OUTPUT"
241244
else
242245
echo "::notice::optools/images/Dockerfile.ci-builder not present; skipping builder image"

.github/workflows/merge-trigger-tke.yaml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
run: |
108108
set -u +e -o pipefail
109109
cd "$GITHUB_WORKSPACE"
110-
docker run --rm \
110+
docker run --rm -i \
111111
-v "$GITHUB_WORKSPACE/matrixone":/go/src/github.com/matrixorigin/matrixone \
112112
-w /go/src/github.com/matrixorigin/matrixone \
113113
-e HOST_UID="$(id -u)" -e HOST_GID="$(id -g)" \
@@ -129,8 +129,15 @@ jobs:
129129
legacy=$(printf "schema=1\nos=%s\narch=%s\nthirdparties_tree=%s" \
130130
"$(uname -s)" "$(uname -m)" "$(git rev-parse HEAD:thirdparties)")
131131
printf '%s\n' "${legacy}" > /tmp/legacy-thirdparties.fingerprint
132-
# Accept the old schema during rollout so an existing builder image
133-
# remains useful until the first schema-2 image is published.
132+
echo "Computed CI builder fingerprint:"
133+
cat /tmp/expected-thirdparties.fingerprint
134+
if [ -r /mo-prebuilt/thirdparties.fingerprint ]; then
135+
echo "Cached CI builder fingerprint:"
136+
cat /mo-prebuilt/thirdparties.fingerprint
137+
fi
138+
# Accept only the pre-helper schema-1 metadata during rollout. The
139+
# schema-3 contract covers the complete native input tree, so older
140+
# partial fingerprints must rebuild rather than risk stale outputs.
134141
if cmp -s /tmp/expected-thirdparties.fingerprint /mo-prebuilt/thirdparties.fingerprint 2>/dev/null \
135142
|| cmp -s /tmp/legacy-thirdparties.fingerprint /mo-prebuilt/thirdparties.fingerprint 2>/dev/null; then
136143
echo "CI builder native fingerprint matched"
@@ -147,6 +154,10 @@ jobs:
147154
if [ "${status}" -ne 0 ]; then
148155
exit "${status}"
149156
fi
157+
# The cached build completed successfully. Fail closed while
158+
# staging its runtime artifacts so a missing library cannot be
159+
# published as a successful image.
160+
set -e
150161
151162
cd "$GITHUB_WORKSPACE/matrixone"
152163
env -u LD_LIBRARY_PATH GOCOVERDIR="$(mktemp -d)" ./mo-service -h >/dev/null

0 commit comments

Comments
 (0)