Repository navigation
fix(oci): fail a publish at the first tag the registry rejects - #64
Merged
Merged
Conversation
PushArtifact only warned when a tag's manifest PUT failed and went on with the remaining tags, so `features publish` and `templates publish` reported the subset that made it and exited 0, and pushed the collection metadata as well. The reference CLI's putManifestWithTags stops at the first rejected tag, logs "Failed to PUT manifest for tag <tag>", and publish logs the "(!) ERR: Failed to publish" lines and exits 1 before the collection metadata and before printing a result. Go now does the same. Tags pushed before the failure stay pushed, as in TS. TestPublishParity gains a tag_failure case that runs both CLIs against a registry that rejects one tag and compares stdout, the exit code, the error lines and the PUTs each one made. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem.
PushArtifactonly warned when a tag's manifest PUT failed and went on with the remaining tags. Sofeatures publish/templates publishprinted the tags that made it, pushed the collection metadata and exited 0. Only "every tag failed" was an error.Reference (v0.90.0).
putManifestWithTags(containerCollectionsOCIPush.ts) stops at the first PUT that isn't 201 and logsFailed to PUT manifest for tag <tag>.doPublishCommandlogs(!) ERR: Failed to publish <type>: '<resource>'.featuresCLI/publish.ts/templatesCLI/publish.tslog(!) ERR: Failed to publish '<resource>'andprocess.exit(1)inside the item loop, so there's no metadata push and no stdout.Fix.
PushArtifactreturns an error at the first failed tag; tags pushed before it stay pushed, as in TS.publishOnealready logged both(!) ERRlines and exited 1 on an error.Tests (fail on
main)TestPushArtifact_BearerAuthAndStopsAtFirstFailedTagreplaces…PartialTagFailure. With1.0rejected, the PUTs are exactly[1 1.0], only1lands, the error names the tag and the resource, and the log hasFailed to PUT manifest for tag 1.0.TestPublishCollection_FailedTagPushExits(feature, template): exit 1, empty stdout, both(!) ERRlines, no metadata PUT. It uses a small in-memory registry,pushRegistry, with the real OCI client.TestPublishParity/tag_failure(feature, template): runs the TS reference and Go against that registry and requires the same stdout, exit code, error lines, tag PUTs and metadata PUTs. Againstmain, Go printed a result, exited 0, PUT[1 1.0 1.0.0 latest]and pushed metadata.Still different from TS (unchanged): the line after
Failed to PUT manifestis oras's error text rather than the registry's JSON body; the success line readsPublished tag: Xwhere TS writesTagged: X -> <location>.Validation (local)
task lint: pass.task parity:publish: pass (tag_failure,features,templates).task test:racewithTMPDIRoutside/tmp: pass.task parity:contract: only the 2 knownread-configuration.features-configuration-local-feature-*cases fail locally (/tmp/.git, same onmain).🤖 Generated with Claude Code