- 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>
- Support for Go 1.21 is dropped, leaving 1.22 the minimum release
- Go base image to 1.24.0
- ECR helper to latest commit
- gosec to v2.22.1
- dominikh/go-tools for staticcheck to v0.6.0
- olareg/olareg to v0.1.2
- Fixing staticcheck linter warnings
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>
A seek to the current location is used to monitor the progress, making it possible for the callback to panic from a data race.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
The current retry limits are imposed at the host level. This change prevents a single request from too many retries for various reasons, including flaky connections and logic loops in the code.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
The `bitIsSet` function was returning the wrong value, forcing nodes to v1.
This also adjusts the automatic appending of the variant to only happen when short values are provided.
This avoids changing `linux/amd64` to `linux/amd64/vx` which would break existing users.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
Avoid updating the "rdr" value until after err is checked since an interface to a nil value is not nil.
This also hardens the blob reader to prevent panics on a nil value.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
Search now prefers better matches rather than first compatible entry.
This also allows hosts on newer variants to select images from older variants.
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>
The blob put method depends on the input being an io.Seeker for retries.
If that is not the case, abort and return the previous error.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
- Adds a struct to the return so headers can be inspected.
- Puts Ping into the scheme interface.
- Adds an ocidir implementation to verify directory is accessible.
- Fixes some http/auth handling.
- Warns on `regctl registry config` and `login` of Ping failure.
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 main goal was to remove unnecessary interfaces. To avoid breaking
users, type aliases were used on the old interface names.
Comments were updated to better align with the godoc style.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
Most of this is error handling. Many of the file IO warnings are
intentionally ignored since these tools are designed to run locally.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
- Move descriptor filter/sort into descriptor funcs
- Reuse those methods for referrers get/list
- Use those methods in artifact get when an index is seen
Signed-off-by: Brandon Mitchell <git@bmitch.net>
- This adds a 4MB manifest put limit (per the OCI spec).
- It also adds an 8MB manifest get limit to prevent DOS attacks.
- Blob reads also stop when the expected length is reached.
- HTTP retry backoff checks were added to read/close methods.
Signed-off-by: Brandon Mitchell <git@bmitch.net>
- descriptor requires mediatype, size, and digest.
- refers field is no longer needed, replaced by subject.
- docker specific config settings are added for showing docker images.
- annotations should be after the subject field.
Signed-off-by: Brandon Mitchell <git@bmitch.net>