diff --git a/pkg/consts/consts.go b/pkg/consts/consts.go index 454ba19..df2231b 100644 --- a/pkg/consts/consts.go +++ b/pkg/consts/consts.go @@ -68,11 +68,8 @@ const ( HaulerIgnoreErrors = "HAULER_IGNORE_ERRORS" // container files and directories - OCIImageIndexFile = "index.json" - OCIImageLayoutFile = "oci-layout" - OCIImageBlobsDir = "blobs" - ImageManifestFile = "manifest.json" - ImageConfigFile = "config.json" + ImageManifestFile = "manifest.json" + ImageConfigFile = "config.json" // other constraints CarbideRegistry = "rgcrprod.azurecr.us" diff --git a/pkg/content/oci.go b/pkg/content/oci.go index dd07743..d32667c 100644 --- a/pkg/content/oci.go +++ b/pkg/content/oci.go @@ -66,7 +66,7 @@ func (o *OCI) AddIndex(desc ocispec.Descriptor) error { // LoadIndex will load the index from disk func (o *OCI) LoadIndex() error { - path := o.path(consts.OCIImageIndexFile) + path := o.path(ocispec.ImageIndexFile) idx, err := os.Open(path) if err != nil { if !os.IsNotExist(err) { @@ -138,7 +138,7 @@ func (o *OCI) SaveIndex() error { if err != nil { return err } - return os.WriteFile(o.path(consts.OCIImageIndexFile), data, 0644) + return os.WriteFile(o.path(ocispec.ImageIndexFile), data, 0644) } // Resolve attempts to resolve the reference into a name and descriptor. @@ -259,7 +259,7 @@ func (o *OCI) blobWriterAt(desc ocispec.Descriptor) (*os.File, error) { } func (o *OCI) ensureBlob(alg string, hex string) (string, error) { - dir := o.path(consts.OCIImageBlobsDir, alg) + dir := o.path(ocispec.ImageBlobsDir, alg) if err := os.MkdirAll(dir, os.ModePerm); err != nil && !os.IsExist(err) { return "", err } diff --git a/pkg/store/store.go b/pkg/store/store.go index aebb790..ebbe711 100644 --- a/pkg/store/store.go +++ b/pkg/store/store.go @@ -151,17 +151,17 @@ func (l *Layout) AddOCICollection(ctx context.Context, collection artifacts.OCIC // This can be a highly destructive operation if the store's directory happens to be inline with other non-store contents // To reduce the blast radius and likelihood of deleting things we don't own, Flush explicitly deletes oci-layout content only func (l *Layout) Flush(ctx context.Context) error { - blobs := filepath.Join(l.Root, consts.OCIImageBlobsDir) + blobs := filepath.Join(l.Root, ocispec.ImageBlobsDir) if err := os.RemoveAll(blobs); err != nil { return err } - index := filepath.Join(l.Root, consts.OCIImageIndexFile) + index := filepath.Join(l.Root, ocispec.ImageIndexFile) if err := os.RemoveAll(index); err != nil { return err } - layout := filepath.Join(l.Root, consts.OCIImageLayoutFile) + layout := filepath.Join(l.Root, ocispec.ImageLayoutFile) if err := os.RemoveAll(layout); err != nil { return err } @@ -240,7 +240,7 @@ func (l *Layout) writeLayer(layer v1.Layer) error { return err } - dir := filepath.Join(l.Root, consts.OCIImageBlobsDir, d.Algorithm) + dir := filepath.Join(l.Root, ocispec.ImageBlobsDir, d.Algorithm) if err := os.MkdirAll(dir, os.ModePerm); err != nil && !os.IsExist(err) { return err }