- Use "any" instead of an empty interface.
- Use range over an integer for for loops.
- Remove shadow variables in loops now that Go no longer reuses the variable.
- Use "slices.Contains", "slices.Delete", "slices.Equal", "slices.Index", "slices.SortFunc".
- Use "cmp.Or", "min", and "max".
- Use "fmt.Appendf" instead of "Sprintf" for generating a byte slice.
- Use "errors.Join" or "fmt.Errorf" with multiple "%w" for multiple errors.
Additionally, use modern regclient features:
- Use "ref.SetTag", "ref.SetDigest", and "ref.AddDigest".
- Call "regclient.ManifestGet" using "WithManifestDesc" instead of setting the digest on the reference.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
The imageSeenOrWait would falsely hit on a digest pushed to a separate repository, skipping the copy of a blob when it should not.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
This updates the regclient Go library.
Existing users of logrus will continue to work using a logrus handler to slog.
Updates to the various commands will be made in a future commit.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
- Priority queue algorithm prefers a small entry (non-blob API), and 50/50 split of largest and oldest queued entries.
- Image reorder starts the blob copies sooner to avoid blocking on the tag listing for referrers or digest tags.
- pqueue.AcquireMulti releases queues in reverse order to minimize risk of an acquire blocked by a soon to release queue.
- Include type and size in the request for priority queue.
- Use expected request size to validate response.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
I feel like I need to explain, this is all to move the descriptor package.
The platform package could not use the predefined errors in types because of a circular dependency from descriptor.
The most appropriate way to reorg this is to move descriptor out of the type package since it was more complex than a self contained type.
When doing that, type aliases were needed to avoid breaking changes to existing users.
Those aliases themselves caused circular dependency loops because of the media types and errors, so those were also pulled out to separate packages.
All of the old values were aliased and deprecated, and to fix the linter, those deprecations were fixed by updating the imports... everywhere.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
- Add NewHost to parse hostname or ocidir path.
- Add IsSet method to verify reference is fully defined.
- Add SetDigest and SetTag methods to create a new Ref.
- Update other packages to use new methods.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
The level check from before would return before the manifest was copied.
This looks for loops in direct parents, and if encountered, it switches
to copy the referrers and digest tags after the manifest is pushed. The
manifest wait group is being removed to reduce complexity and remove
deadlock issues.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
- Include referrers in pretty printers
- Set correct reference when copying
- Treat referrers as child objects before Refer is pushed
- Create artifacts with minimal refer descriptor (exclude annotations)
Signed-off-by: Brandon Mitchell <git@bmitch.net>
- Attempt to pull external blob from registry
- Handle blob pull to external URL
- Copy option to copy external blobs
- Mod option to remove external URLs from descriptors
Signed-off-by: Brandon Mitchell <git@bmitch.net>