Fix invalid --plain-http flag on oras cp - #774
Open
bschwedler wants to merge 1 commit into
Open
Conversation
oras cp has two endpoints, so unlike every other oras subcommand it takes --from-plain-http and --to-plain-http rather than a single --plain-http. OrasCopy emitted the bare form whenever plain_http was set, which exits with "unknown flag" against oras 1.3.3. Each flag is now emitted only when that end is actually a registry, since an OCI layout is a filesystem path and a plain-HTTP flag aimed at it is meaningless. Production was unaffected because plain_http is only set for local registries, but any local-registry publish path failed immediately, covering local development, the oven, and integration tests that publish against a registry container. The existing test asserted the broken form and passed, because it only checked command construction and never invoked oras. It now asserts the per-endpoint flags, alongside a regression guard that no layout combination emits the bare flag and coverage for dropping the flag aimed at a layout endpoint.
Test Results2 258 tests 2 258 ✅ 11m 37s ⏱️ Results for commit a6c5429. |
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.
oras cphas two endpoints, so unlike every other oras subcommand it takes--from-plain-httpand--to-plain-httprather than a single--plain-http.OrasCopy.commandemitted the bare form wheneverplain_httpwas set:Confirmed against oras 1.3.3, whose
cp --helplists only the per-endpoint flags. Sibling subcommands (manifest fetch,manifest index create) do accept--plain-http, soOrasCommand's shared field is correct everywhere exceptOrasCopy.Each flag is now emitted only when that end is actually a registry — an OCI layout is a filesystem path, and a plain-HTTP flag aimed at it is meaningless:
from_oci_layoutto_oci_layout--from-plain-http --to-plain-http--to-plain-httponly--from-plain-httponlyImpact
Production is unaffected —
plain_httpis only set for local registries. But any local-registry publish path failed immediately, which covers local development, the oven, and integration tests publishing against aregistry:3container.Why the tests did not catch it
test_copy_with_plain_httpcovered this flag and passed, because it only asserted command construction — oras is never invoked, so it asserted the broken form was built correctly.That gap is not fully closed here. Unit tests cannot validate flag validity; only running oras can. This PR updates the assertion, adds a regression guard that no layout combination emits the bare flag, and covers dropping the flag aimed at a layout endpoint. An integration test that actually invokes oras against
test/helpers/registry_container.pywould be the real fix, and is worth considering separately.Verification
ruff checkandruff format --checkcleanpytest test/plugins/builtin/imagetools/→ 134 passedTestFindOrasBin::test_find_from_path, is pre-existing and environmental (orasnot on PATH); confirmed by running the same suite on unmodified code (60 passed → 62 passed with this change, same one failure)Found while validating the retained-OCI-layout publish change.