export: add --skip-non-distributable

The flag skips adding non-distributable blobs such as Windows layers to archive.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda
2021-01-01 06:29:00 +09:00
parent 9067796ce4
commit e2e2c5737d
3 changed files with 54 additions and 7 deletions

View File

@@ -102,6 +102,12 @@ func parseMediaTypes(mt string) (string, []string) {
return s[0], ext
}
// IsNonDistributable returns true if the media type is non-distributable.
func IsNonDistributable(mt string) bool {
return strings.HasPrefix(mt, "application/vnd.oci.image.layer.nondistributable.") ||
strings.HasPrefix(mt, "application/vnd.docker.image.rootfs.foreign.")
}
// IsLayerTypes returns true if the media type is a layer
func IsLayerType(mt string) bool {
if strings.HasPrefix(mt, "application/vnd.oci.image.layer.") {