Swapping bundle publish to OCI#151
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the legacy S3-based bundle publisher and packager with an OCI registry workflow using ORAS, updates the CLI to use the Massdriver SDK and ORAS targets, and adds test data and tests for the new PackageBundle behavior.
- Introduces
PublishBundleandPackageBundlemethods underpkg/commands/publishleveraging ORAS and go-gitignore - Updates
cmd/bundle.goandpkg/commands/publish/main.goto wire in the new SDK client and ORAS-based flow - Adds
testdata/simplefixtures and apackage_test.goto verify manifest layers and media types
Reviewed Changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/commands/publish/publisher.go & packager.go | Removed legacy S3-based publisher and packager code |
| pkg/commands/publish/publish.go | Added ORAS-based Publisher.PublishBundle implementation |
| pkg/commands/publish/package.go | Added Publisher.PackageBundle using filepath.Walk & go-gitignore |
| pkg/commands/publish/mime.go | Added MIME type mapping; defaults to "nil" |
| pkg/commands/publish/package_test.go | New tests for PackageBundle verifying layer annotations & types |
| cmd/bundle.go | Renamed CLI flag to bundle-directory; integrated Massdriver SDK |
| pkg/commands/publish/main.go | Updated Run to use SDK client, memory store, and ORAS calls |
| pkg/commands/publish/testdata/simple/* | Sample bundle files for tests |
| go.mod | Upgraded Go version and bumped dependencies for ORAS usage |
| .github/workflows/lint.yaml | Bumped Go version and updated golangci-lint action |
Comments suppressed due to low confidence (2)
pkg/commands/publish/main.go:319
- [nitpick] The tag is hard-coded to "latest" with no CLI override; consider adding a flag or parameter so users can specify a custom OCI tag.
tag := "latest"
.github/workflows/lint.yaml:25
- [nitpick] The
versionhere refers to the golangci-lint binary, not the action release; verify the intended lint version and use a matching semantic tag (e.g.,v1.xorlatest).
version: v2.1
| if mimeType, exists := mimeTypesFromExt[ext]; exists { | ||
| return mimeType | ||
| } | ||
| return "nil" |
There was a problem hiding this comment.
Returning "nil" as the default MIME type yields an invalid media type; consider using a sensible fallback such as "application/octet-stream" or "text/plain" instead.
| return "nil" | |
| return "application/octet-stream" |
| if mimeType, exists := mimeTypesFromExt[ext]; exists { | ||
| return mimeType |
There was a problem hiding this comment.
Special multi-part extensions like ".tar.gz" won't match here because filepath.Ext returns only ".gz"; you may need to detect and handle compound extensions before the standard lookup.
| if mimeType, exists := mimeTypesFromExt[ext]; exists { | |
| return mimeType | |
| // Split the extension into parts for compound extensions | |
| parts := strings.Split(ext, ".") | |
| for i := len(parts) - 1; i >= 0; i-- { | |
| compoundExt := "." + strings.Join(parts[i:], ".") | |
| if mimeType, exists := mimeTypesFromExt[compoundExt]; exists { | |
| return mimeType | |
| } |
Changing the
mass bundle publishto push to an OCI registry.