fix(testing): gate ctr image import --local by detected ctr version - #1177
Open
HarnageaGabriel wants to merge 4 commits into
Open
fix(testing): gate ctr image import --local by detected ctr version#1177HarnageaGabriel wants to merge 4 commits into
HarnageaGabriel wants to merge 4 commits into
Conversation
ctr image import --all-platforms fails on containerd v2.0+ with "unable to initialize unpacker: no unpack platforms defined: invalid argument" (containerd/containerd#7592). The fix is passing --local, but that flag does not exist on ctr < 1.7.7, and runwasi still supports ctr as old as 1.6.25. Detect the ctr version at runtime via `ctr --version` and only add --local when >= 1.7.7, falling back to the old behavior if detection fails. Fixes containerd#579 Signed-off-by: HarnageaGabriel <gabriel.harnagea06@gmail.com>
The generated test images contain WASM content but declare no rootfs diff IDs. Running ctr's local unpack path is unnecessary and can leave snapshot cleanup racing later stress tests, causing intermittent "parent snapshot ... does not exist" failures. Keep legacy ctr imports unchanged while retaining --local for versions that require it. Signed-off-by: HarnageaGabriel <gabriel.harnagea06@gmail.com>
HarnageaGabriel
force-pushed
the
fix-issue-579-ctr-import-local
branch
from
August 12, 2026 16:59
7003a77 to
e1c019b
Compare
- wrap bare URL in vendor/containerd_shim/mod.rs in angle brackets - drop private intra-doc link to OtlpConfig in shim/mod.rs module doc Pre-existing warnings unrelated to this PR's diff, surfaced by RUSTFLAGS=-D warnings in the docs job and blocking CI green.
…ll download) Signed-off-by: HarnageaGabriel <gabriel.harnagea06@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #579.
The Makefile
loadtarget originally reported in this issue (ctr -n default image import --all-platforms dist/img.tar) no longer exists — it was removed in 570a9fe (Jan 2025), well after this issue was filed, when the project switched to pulling published images instead of importing locally built ones.The same underlying bug is still present in
crates/containerd-shim-wasm/src/testing.rs,import_image(), which is used by the real test suite (3 call sites) and shells out toctr -n <ns> image import --all-platforms <tar>. On containerd v2.0+ this fails with:The known workaround is
--local(containerd/containerd#7592), but that flag doesn't exist on ctr < 1.7.7, and runwasi still supports ctr as old as 1.6.25 — so the flag can't be added unconditionally.Changes
ctrversion at runtime viactr --versionand parse it withsemver.--localwhen the detected version is>= 1.7.7.--local) rather than failing the test helper.semveradded as an optional dependency gated behind the existingtestingfeature; it was already present inCargo.lockvia another crate, so the lock only gained one line.Test plan
git diff --checkclean, changes scoped to 3 filescargo check/cargo buildin the environment this was authored in (no local Rust toolchain) — relying on CI to compile-check