@@ -23,7 +23,6 @@ import (
2323 "github.com/pkg/errors"
2424 "github.com/sirupsen/logrus"
2525 "github.com/spf13/cobra"
26- "github.com/spf13/pflag"
2726)
2827
2928const ( // Docker specific annotations and values
@@ -40,8 +39,6 @@ const ( // Docker specific annotations and values
4039
4140type pushOptions struct {
4241 tag string
43- platforms []string
44- allPlatforms bool
4542}
4643
4744func pushCmd (dockerCli command.Cli ) * cobra.Command {
@@ -51,17 +48,12 @@ func pushCmd(dockerCli command.Cli) *cobra.Command {
5148 Short : "Push an App image to a registry" ,
5249 Example : `$ docker app push myapp --tag myrepo/myapp:mytag` ,
5350 Args : cli .RequiresMaxArgs (1 ),
54- PreRunE : func (cmd * cobra.Command , args []string ) error {
55- return checkFlags (cmd .Flags (), opts )
56- },
5751 RunE : func (cmd * cobra.Command , args []string ) error {
5852 return runPush (dockerCli , firstOrEmpty (args ), opts )
5953 },
6054 }
6155 flags := cmd .Flags ()
6256 flags .StringVarP (& opts .tag , "tag" , "t" , "" , "Target registry reference (default: <name>:<version> from metadata)" )
63- flags .StringSliceVar (& opts .platforms , "platform" , []string {"linux/amd64" }, "For multi-arch service images, push the specified platforms" )
64- flags .BoolVar (& opts .allPlatforms , "all-platforms" , false , "If present, push all platforms" )
6557 return cmd
6658}
6759
@@ -80,7 +72,7 @@ func runPush(dockerCli command.Cli, name string, opts pushOptions) error {
8072 cnabRef = reference .TagNameOnly (cnabRef )
8173
8274 // Push the bundle
83- return pushBundle (dockerCli , opts , bndl , cnabRef )
75+ return pushBundle (dockerCli , bndl , cnabRef )
8476}
8577
8678func resolveReferenceAndBundle (dockerCli command.Cli , name string ) (* bundle.Bundle , string , error ) {
@@ -99,7 +91,7 @@ func resolveReferenceAndBundle(dockerCli command.Cli, name string) (*bundle.Bund
9991 return bndl , ref , err
10092}
10193
102- func pushBundle (dockerCli command.Cli , opts pushOptions , bndl * bundle.Bundle , cnabRef reference.Named ) error {
94+ func pushBundle (dockerCli command.Cli , bndl * bundle.Bundle , cnabRef reference.Named ) error {
10395 insecureRegistries , err := internal .InsecureRegistriesFromEngine (dockerCli )
10496 if err != nil {
10597 return errors .Wrap (err , "could not retrieve insecure registries" )
@@ -114,9 +106,6 @@ func pushBundle(dockerCli command.Cli, opts pushOptions, bndl *bundle.Bundle, cn
114106 remotes .WithAutoBundleUpdate (),
115107 remotes .WithPushImages (dockerCli .Client (), dockerCli .Out ()),
116108 }
117- if platforms := platformFilter (opts ); len (platforms ) > 0 {
118- fixupOptions = append (fixupOptions , remotes .WithComponentImagePlatforms (platforms ))
119- }
120109 // bundle fixup
121110 relocationMap , err := remotes .FixupBundle (context .Background (), bndl , cnabRef , resolver , fixupOptions ... )
122111 if err != nil {
@@ -141,13 +130,6 @@ func withAppAnnotations(index *ocischemav1.Index) error {
141130 return nil
142131}
143132
144- func platformFilter (opts pushOptions ) []string {
145- if opts .allPlatforms {
146- return nil
147- }
148- return opts .platforms
149- }
150-
151133type fixupDisplay interface {
152134 onEvent (remotes.FixupEvent )
153135}
@@ -276,10 +258,3 @@ func (r *plainDisplay) onEvent(ev remotes.FixupEvent) {
276258 }
277259 }
278260}
279-
280- func checkFlags (flags * pflag.FlagSet , opts pushOptions ) error {
281- if opts .allPlatforms && flags .Changed ("all-platforms" ) && flags .Changed ("platform" ) {
282- return fmt .Errorf ("--all-plaforms and --plaform flags cannot be used at the same time" )
283- }
284- return nil
285- }
0 commit comments