Update imagestore interface to support multiple references

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan
2023-01-11 08:12:36 -08:00
parent 20de989afc
commit 081601f521
10 changed files with 996 additions and 212 deletions

View File

@@ -114,16 +114,17 @@ If foobar.tar contains an OCI ref named "latest" and anonymous ref "sha256:deadb
if !context.BoolT("local") {
var opts []image.StoreOpt
prefix := context.String("base-name")
var overwrite bool
if prefix == "" {
prefix = fmt.Sprintf("import-%s", time.Now().Format("2006-01-02"))
opts = append(opts, image.WithNamePrefix(prefix, false))
} else {
// When provided, filter out references which do not match
opts = append(opts, image.WithNamePrefix(prefix, true))
// Allow overwriting auto-generated prefix with named annotation
overwrite = true
}
if context.Bool("digests") {
opts = append(opts, image.WithDigestRefs(!context.Bool("skip-digest-for-named")))
opts = append(opts, image.WithDigestRef(prefix, overwrite, !context.Bool("skip-digest-for-named")))
} else {
opts = append(opts, image.WithNamedPrefix(prefix, overwrite))
}
// TODO: Add platform options