Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit f2408b6

Browse files
committed
Remove tag flag for push
Signed-off-by: Yves Brissaud <yves.brissaud@docker.com>
1 parent 447b9e2 commit f2408b6

2 files changed

Lines changed: 19 additions & 18 deletions

File tree

e2e/pushpull_test.go

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ func TestPushInstall(t *testing.T) {
4646
runWithDindSwarmAndRegistry(t, func(info dindSwarmAndRegistryInfo) {
4747
cmd := info.configuredCmd
4848
ref := info.registryAddress + "/test/push-pull"
49-
cmd.Command = dockerCli.Command("app", "push", "--tag", ref, filepath.Join("testdata", "push-pull", "push-pull.dockerapp"))
49+
path := filepath.Join("testdata", "push-pull")
50+
cmd.Command = dockerCli.Command("app", "build", "-f", filepath.Join(path, "push-pull.dockerapp"), "-t", ref, path)
51+
icmd.RunCmd(cmd).Assert(t, icmd.Success)
52+
cmd.Command = dockerCli.Command("app", "push", ref)
5053
icmd.RunCmd(cmd).Assert(t, icmd.Success)
5154

5255
cmd.Command = dockerCli.Command("app", "run", ref, "--name", t.Name())
@@ -61,7 +64,10 @@ func TestPushPullInstall(t *testing.T) {
6164
cmd := info.configuredCmd
6265
ref := info.registryAddress + "/test/push-pull"
6366
tag := ":v.0.0.1"
64-
cmd.Command = dockerCli.Command("app", "push", "--tag", ref+tag, filepath.Join("testdata", "push-pull", "push-pull.dockerapp"))
67+
path := filepath.Join("testdata", "push-pull")
68+
cmd.Command = dockerCli.Command("app", "build", "-f", filepath.Join(path, "push-pull.dockerapp"), "-t", ref+tag, path)
69+
icmd.RunCmd(cmd).Assert(t, icmd.Success)
70+
cmd.Command = dockerCli.Command("app", "push", ref+tag)
6571
icmd.RunCmd(cmd).Assert(t, icmd.Success)
6672
cmd.Command = dockerCli.Command("app", "pull", ref+tag)
6773
icmd.RunCmd(cmd).Assert(t, icmd.Success)
@@ -72,8 +78,6 @@ func TestPushPullInstall(t *testing.T) {
7278
// install from local store
7379
cmd.Command = dockerCli.Command("app", "run", ref+tag, "--name", t.Name())
7480
icmd.RunCmd(cmd).Assert(t, icmd.Success)
75-
cmd.Command = dockerCli.Command("service", "ls")
76-
assert.Check(t, cmp.Contains(icmd.RunCmd(cmd).Assert(t, icmd.Success).Combined(), ref))
7781

7882
// listing the installed application shows the pulled application reference
7983
cmd.Command = dockerCli.Command("app", "ls")
@@ -107,7 +111,9 @@ func TestPushInstallBundle(t *testing.T) {
107111
// push it and install to check it is available
108112
t.Run("push-bundle", func(t *testing.T) {
109113
name := strings.Replace(t.Name(), "/", "_", 1)
110-
cmd.Command = dockerCli.Command("app", "push", "--tag", ref, "a-simple-app:1.0.0")
114+
cmd.Command = dockerCli.Command("app", "image", "tag", "a-simple-app:1.0.0", ref)
115+
icmd.RunCmd(cmd).Assert(t, icmd.Success)
116+
cmd.Command = dockerCli.Command("app", "push", ref)
111117
icmd.RunCmd(cmd).Assert(t, icmd.Success)
112118

113119
cmd.Command = dockerCli.Command("app", "run", ref, "--name", name)
@@ -127,7 +133,9 @@ func TestPushInstallBundle(t *testing.T) {
127133
t.Run("push-ref", func(t *testing.T) {
128134
name := strings.Replace(t.Name(), "/", "_", 1)
129135
ref2 := info.registryAddress + "/test/push-ref"
130-
cmd.Command = dockerCli.Command("app", "push", "--tag", ref2, ref+":latest")
136+
cmd.Command = dockerCli.Command("app", "image", "tag", ref+":latest", ref2)
137+
icmd.RunCmd(cmd).Assert(t, icmd.Success)
138+
cmd.Command = dockerCli.Command("app", "push", ref2)
131139
icmd.RunCmd(cmd).Assert(t, icmd.Success)
132140

133141
cmd.Command = dockerCli.Command("app", "run", ref2, "--name", name)

internal/commands/push.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,20 @@ const ( // Docker specific annotations and values
3737
DockerTypeApp = "app"
3838
)
3939

40-
type pushOptions struct {
41-
tag string
42-
}
43-
4440
func pushCmd(dockerCli command.Cli) *cobra.Command {
45-
var opts pushOptions
4641
cmd := &cobra.Command{
47-
Use: "push [OPTIONS] APP_IMAGE",
42+
Use: "push APP_IMAGE",
4843
Short: "Push an App image to a registry",
49-
Example: `$ docker app push myapp --tag myrepo/myapp:mytag`,
50-
Args: cli.RequiresMaxArgs(1),
44+
Example: `$ docker app push myrepo/myapp:mytag`,
45+
Args: cli.ExactArgs(1),
5146
RunE: func(cmd *cobra.Command, args []string) error {
52-
return runPush(dockerCli, firstOrEmpty(args), opts)
47+
return runPush(dockerCli, args[0])
5348
},
5449
}
55-
flags := cmd.Flags()
56-
flags.StringVarP(&opts.tag, "tag", "t", "", "Target registry reference (default: <name>:<version> from metadata)")
5750
return cmd
5851
}
5952

60-
func runPush(dockerCli command.Cli, name string, opts pushOptions) error {
53+
func runPush(dockerCli command.Cli, name string) error {
6154
defer muteDockerCli(dockerCli)()
6255
// Get the bundle
6356
bndl, ref, err := resolveReferenceAndBundle(dockerCli, name)

0 commit comments

Comments
 (0)