Skip to content

Commit

Permalink
restore option to set manifest type to OCI or Docker
Browse files Browse the repository at this point in the history
Signed-off-by: Avi Deitcher <avi@deitcher.net>
  • Loading branch information
deitch committed Jul 28, 2022
1 parent e3d7d5b commit 0a890bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 10 additions & 2 deletions v2/cmd/manifest-tool/push.go
Expand Up @@ -52,7 +52,11 @@ var pushCmd = cli.Command{
logrus.Fatalf(fmt.Sprintf("Can't unmarshal YAML file %q: %v", filePath, err))
}

digest, length, err := registry.PushManifestList(c.GlobalString("username"), c.GlobalString("password"), yamlInput, c.Bool("ignore-missing"), c.GlobalBool("insecure"), c.GlobalBool("plain-http"), c.GlobalString("docker-cfg"))
manifestType := types.Docker
if c.GlobalString("type") == "oci" {
manifestType = types.OCI
}
digest, length, err := registry.PushManifestList(c.GlobalString("username"), c.GlobalString("password"), yamlInput, c.Bool("ignore-missing"), c.GlobalBool("insecure"), c.GlobalBool("plain-http"), manifestType, c.GlobalString("docker-cfg"))
if err != nil {
logrus.Fatal(err)
}
Expand Down Expand Up @@ -115,7 +119,11 @@ var pushCmd = cli.Command{
Image: target,
Manifests: srcImages,
}
digest, length, err := registry.PushManifestList(c.GlobalString("username"), c.GlobalString("password"), yamlInput, c.Bool("ignore-missing"), c.GlobalBool("insecure"), c.GlobalBool("plain-http"), c.GlobalString("docker-cfg"))
manifestType := types.Docker
if c.GlobalString("type") == "oci" {
manifestType = types.OCI
}
digest, length, err := registry.PushManifestList(c.GlobalString("username"), c.GlobalString("password"), yamlInput, c.Bool("ignore-missing"), c.GlobalBool("insecure"), c.GlobalBool("plain-http"), manifestType, c.GlobalString("docker-cfg"))
if err != nil {
logrus.Fatal(err)
}
Expand Down
5 changes: 2 additions & 3 deletions v2/pkg/registry/push.go
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/sirupsen/logrus"
)

func PushManifestList(username, password string, input types.YAMLInput, ignoreMissing, insecure, plainHttp bool, configDir string) (hash string, length int, err error) {
func PushManifestList(username, password string, input types.YAMLInput, ignoreMissing, insecure, plainHttp bool, manifestType types.ManifestType, configDir string) (hash string, length int, err error) {
// resolve the target image reference for the combined manifest list/index
targetRef, err := reference.ParseNormalizedNamed(input.Image)
if err != nil {
Expand All @@ -28,12 +28,11 @@ func PushManifestList(username, password string, input types.YAMLInput, ignoreMi
resolver := util.NewResolver(username, password, insecure,
plainHttp, configDirs...)

imageType := types.Docker
manifestList := types.ManifestList{
Name: input.Image,
Reference: targetRef,
Resolver: resolver,
Type: imageType,
Type: manifestType,
}
// create an in-memory store for OCI descriptors and content used during the push operation
memoryStore := store.NewMemoryStore()
Expand Down

0 comments on commit 0a890bf

Please sign in to comment.