Skip to content

ci: reuse verified ONNX Runtime from the shared builder - #33427

Merged
XuPeng-SH merged 8 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/shared-ci-builder-onnx-runtime
Nov 30, 2026
Merged

XuPeng-SH merged 8 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/shared-ci-builder-onnx-runtime

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • Test and CI

Which issue(s) this PR fixes:

Related to #26664.

What this PR does / why we need it:

The shared ci-builder image carries the ONNX Runtime library in its prebuilt third-party tree. A different native build fingerprint, as seen on the 4.2 Shared Build, prevents restoring the full tree. That build downloaded 21.9 MiB of ONNX Runtime over HTTPS. Shared Build log

Expose the existing library at the versioned ONNX preload path using a symbolic link. The Makefile supplies the version and platform filename. The downloader checks the installed library and reuses it with read access. It verifies new files from the image or HTTPS and atomically publishes them with mode 0644. An image without the versioned entry uses the existing download path.

#33421 uses the same preload path on 4.2-dev. Both branches currently pin the same Linux ONNX Runtime bytes. After the next successful publication of the existing ci-builder image, confirm the preload hit in Shared Build on both branches.

Validation

  • The downloader suite passed on macOS and Linux amd64/arm64. Running the real ONNX Makefile target under a separate Linux UID reused the verified 0664 library in directories with and without write access.
  • Built a network-disabled amd64 image fixture with the actual export and copy instructions and the verified published ONNX artifact. Both branches installed through the versioned link and rejected a corrupt preload while preserving the previous destination. The loader resolved the artifact dependencies.
  • Both branches reused the published arm64 library offline. With the preload absent, a real loopback HTTPS primary 404 selected the fallback and installed byte-identical verified data on both branches.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 8858d63fa4225b6d60718b74d36e283cae6ec148

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 8858d63fa4225b6d60718b74d36e283cae6ec148

Assessment: request_changes

The versioned preload works in an offline image fixture, but the new ONNX cache-hit path fails when a valid installed library is owned by another user. The design otherwise reuses the existing pinned artifact and centralizes verification in the downloader.

Model: gpt-6.1-terra / max

Session: 01a21fca-22ff-76e2-85da-e9ad78f4f51d · slot 3 · generation 8

  • P2 thirdparties/Makefile:212: A checksum-valid ONNX library is already installed with mode 0644 but is owned by another user, such as after a container build writes into a shared checkout.
    Impact: The base Makefile accepts the readable library. This change routes the cache hit through the downloader, whose unconditional chmod fails with “Operation not permitted,” causing the native build to stop. Avoid requiring chmod when a verified file already has the required permissions, while retaining permission repair for files that need it.
    Evidence: With the same pinned 23,023,576-byte library owned by UID 65534 and the build running as UID 1001, nonowner-baseline.log passes and nonowner-candidate.log fails at thirdparties/download:127. Receipts checks/1795847738566834309-5.json and checks/1795847749261151869-5.json record the respective exits.

Validation:

  • The downloader regression suite passed, including the new valid and invalid preload cases.

  • A network-disabled amd64 Docker fixture executed the exact new export and cross-stage COPY instructions, then installed the source-pinned ONNX artifact through the real Makefile with curl unavailable.

  • An oversized preload was rejected while preserving the previous destination and cleaning temporary files. Linux arm64 and macOS arm64 cache-path mappings were checked.

  • Receipts, retained logs, discussion coverage, and the unchanged source head were reconciled in review-audit.log.

Limitations:

  • The complete ci-builder image was not rebuilt; the image check used a minimal fixture containing the changed instructions and pinned artifact.

  • Initial image-fixture attempts failed because of the diagnostic Docker configuration and a missing fixture utility; the corrected fixture passed.

  • The shared-build CI job was still in progress in the supplied evidence.

@XuPeng-SH

Copy link
Copy Markdown
Contributor Author

mo-bot work · mo-bot-local · reviewing

Commit: 8858d63fa4225b6d60718b74d36e283cae6ec148

Review in progress.

@XuPeng-SH

XuPeng-SH commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · superseded

Commit: d6e4073702c1fef90faa65cfb539bd28fe8d201d

"interrupted"

@XuPeng-SH

XuPeng-SH commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 8d24bff23b7bc37bf1f9879bafed875d2972cf2c

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 8d24bff23b7bc37bf1f9879bafed875d2972cf2c

Assessment: approve

The change reuses the existing verified ONNX library through a versioned image link and the shared downloader. Verified cache hits no longer attempt chmod, resolving both prior non-owner failures. New installations retain checksum verification and atomic publication, and the image preserves the cache export order.

Model: gpt-6.1-terra / max

Session: 01a22087-cef5-7962-9206-10e0932e0fda · slot 1 · generation 34

Validation:

  • The downloader regression suite passed, including cache permissions, corrupt preloads, retry behavior and atomic publication. Evidence: download-suite.log and checks/1795880909537577090-2.json.

  • All five CI builder contract tests passed. Evidence: ci-builder-tests.log and checks/1795880909333584310-2.json.

  • An offline amd64 image fixture using the current Dockerfile instructions installed the pinned library without network access. Evidence: image-fixture-prepare.log, image-fixture-build-final.log, checks/1795880984111666990-2.json and checks/1795881103763639871-2.json.

  • Make cache-path selection passed for Linux x86_64, Linux aarch64 and Darwin arm64. Evidence: cache-path-*.log and checks/1795881120499745485-2.json, checks/1795881120499758852-2.json and checks/1795881120499748114-2.json.

Limitations:

  • The full production CI builder image was not built, and current CI results were not supplied.

  • The ARM and macOS checks verified path selection only; they were not runtime tests on those platforms.

  • The first offline fixture run failed because its synthetic minimal image lacked printf. After adding that fixture utility, the same check passed.

mergify Bot pushed a commit that referenced this pull request Nov 29, 2026
## What type of PR is this?

- [x] Test and CI

## Which issue(s) this PR fixes:

Related to #33416, #26664 and #33408.

## What this PR does / why we need it:

Backport the verified local ONNX Runtime path from #27325 to `4.2-dev`. Use the published Go 1.26.4 native builder image. The existing downloader owns validation and atomic installation for installed, preloaded and HTTPS sources. A warm hit restores mode `0644`. A missing cache invokes the existing HTTPS and LFS fallback. A corrupt preload is rejected without replacing the destination.

| Linux architecture | Local ONNX library | Additional compressed image layer |
| --- | ---: | ---: |
| amd64 | 23,023,576 bytes | 8,603,979 bytes |
| arm64 | 19,543,040 bytes | 7,720,445 bytes |

Compared with the current base image, only the additional layer needs to be pulled when the previous layers are cached. The warm ONNX build has zero network transfer.

The regular Docker images use the native base directly. Shared Build uses the existing image published from `main`. [#33427](#33427) exports its already-installed ONNX Runtime at the same versioned path with a symbolic link, so Shared Build can reuse the library even when its complete third-party fingerprint differs. The library is identical on both branches. Shared Build hits start with the next successful image publication containing that change.

Validated with the published Linux libraries and external networking disabled. On amd64, cache hits with only `sha256sum` and no curl succeeded and installed mode `0600` was repaired. A corrupt preload left the original destination intact. A loopback HTTPS primary 404 reached the fallback and produced a byte-identical library. On arm64 the published library and the downloader regression suite passed.

Synced to the latest `4.2-dev` and reran the Linux downloader suite. The same network-disabled amd64 image fixture verified the link exported by #33427 with the real ONNX library on both branches. Both branches passed the offline arm64 test and the loopback HTTPS primary-404 and fallback check.

Approved-by: fengttt <[email protected]>
@XuPeng-SH
XuPeng-SH merged commit 0197e71 into matrixorigin:main Nov 30, 2026
14 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/shared-ci-builder-onnx-runtime branch November 30, 2026 04:58

This branch was previously deployed

1 inactive deployment
ci — 86f957e0 Deployed Nov 30, 2026 by XuPeng-SH via Matrixone Utils CI / pr-size-label #66975
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/test-ci size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants