Added Exported libs to Hauler#579
Open
bcdurden wants to merge 2 commits intohauler-dev:mainfrom
Open
Conversation
…sive. Does not affect hauler-cli command path, only external-facing import features added
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands Hauler’s public Go API by adding exported pkg/store helpers that mirror existing CLI store behaviors, enabling programmatic use of store sync/add/save capabilities.
Changes:
- Added exported store APIs for syncing manifests/image lists and adding files/images/charts with options.
- Added exports-manifest writer (
manifest.json) support for OCI layouts, plus anExportstracking type. - Added unit/integration-style tests for the new exported APIs and fixed chart repo URL handling in
pkg/content/chart.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/store/sync.go | New exported Sync API and SyncOptions plus internal helpers for manifest and image.txt processing |
| pkg/store/sync_test.go | Tests for SyncOptions.Validate, Sync, and the internal sync helpers |
| pkg/store/save.go | New exported WriteExportsManifest and Exports helper type for generating manifest.json |
| pkg/store/save_test.go | Tests for WriteExportsManifest behavior and Exports getters |
| pkg/store/add.go | New exported AddFile, AddImageWithOpts, RewriteReference, and chart/image helper utilities |
| pkg/store/add_test.go | Tests covering file/image/chart addition, rewrites, and image discovery helpers |
| pkg/content/chart/chart.go | Adjusted repoURL handling to avoid incorrectly prefixing empty repo URLs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
PR Merge Request — Export Hauler Public API
Please check below, if the PR fulfills these requirements:
Associated Links:
Types of Changes:
Proposed Changes:
Hauler has a gap in its exported Go libraries, making it difficult to call the tool programmatically as a library. This PR exports five functions from
pkg/store/that mirror the logic already present incmd/hauler/cli/store/.The CLI continues to use its existing internal code paths — this is not a refactoring. It is a parallel export of the CLI's capabilities into the public API surface. The five exports are:
WriteExportsManifest— standalone manifest generationAddFile— file storage path exportAddImageWithOpts+RewriteReference— image storage with configurable options and Docker Hub registry preservationAddChartWithOpts+ helpers — Helm chart storageSync— orchestrator composing the above, withSyncOptions.Validate()For simpler commands, the mapping was straightforward. For compositional commands like
sync, additional plumbing (SyncOptions,Validate(), related helpers) was added because the CLI's existing flag-heavy approach scattered these concerns across multiple internal types.Verification/Testing of Changes:
The CLI does not yet call these new exported functions — that migration was out of scope. Unit tests are included in the same
pkg/packages where the functions live.Manual verification:
go test ./...andmake buildshould pass. The changes are entirely additive — newpkg/store/files with zero modifications to existing CLI behavior or internal packages.Additional Context:
This is a single PR consolidating five exports. They are designed to be independently reviewable, but consolidated here for merge management.
Design decisions:
_Optionssuffix to avoid conflicts with existinginternal/flags/types.Exportstype uses unexported fields with getter methods (Digests(),Records()) rather than exported fields to enforce invariants.pkg/, neverinternal/, ensuring the public API is self-contained.