Merge pull request #10321 from ktock/ctr-local-flag-deps

ctr: return explicit errors for flags unsupported by transfer service
This commit is contained in:
Maksym Pavlenko 2024-06-11 17:10:28 +00:00 committed by GitHub
commit 8247b5755a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 0 deletions

View File

@ -115,6 +115,12 @@ If foobar.tar contains an OCI ref named "latest" and anonymous ref "sha256:deadb
defer cancel()
if !context.Bool("local") {
unsupportedFlags := []string{"discard-unpacked-layers"}
for _, s := range unsupportedFlags {
if context.IsSet(s) {
return fmt.Errorf("\"--%s\" requires \"--local\" flag", s)
}
}
var opts []image.StoreOpt
prefix := context.String("base-name")
var overwrite bool

View File

@ -100,6 +100,15 @@ command. As part of this process, we do the following:
defer cancel()
if !context.Bool("local") {
unsupportedFlags := []string{"max-concurrent-downloads", "print-chainid",
"skip-verify", "tlscacert", "tlscert", "tlskey", "http-dump", "http-trace", // RegistryFlags
}
for _, s := range unsupportedFlags {
if context.IsSet(s) {
return fmt.Errorf("\"--%s\" requires \"--local\" flag", s)
}
}
ch, err := commands.NewStaticCredentials(ctx, context, ref)
if err != nil {
return err

View File

@ -96,6 +96,16 @@ var pushCommand = &cli.Command{
defer cancel()
if !context.Bool("local") {
unsupportedFlags := []string{
"manifest", "manifest-type", "max-concurrent-uploaded-layers", "allow-non-distributable-blobs",
"skip-verify", "tlscacert", "tlscert", "tlskey", "http-dump", "http-trace", // RegistryFlags
}
for _, s := range unsupportedFlags {
if context.IsSet(s) {
return fmt.Errorf("\"--%s\" requires \"--local\" flag", s)
}
}
ch, err := commands.NewStaticCredentials(ctx, context, ref)
if err != nil {
return err