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

Commit 71196d4

Browse files
committed
Allow user to configure repo name with save and push commands
Signed-off-by: Joffrey F <joffrey@docker.com>
1 parent 66ee35d commit 71196d4

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

cmd/docker-app/push.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
type pushOptions struct {
1212
namespace string
1313
tag string
14+
repo string
1415
}
1516

1617
func pushCmd() *cobra.Command {
@@ -25,7 +26,7 @@ func pushCmd() *cobra.Command {
2526
return err
2627
}
2728
defer app.Cleanup()
28-
dgst, err := packager.Push(app, opts.namespace, opts.tag)
29+
dgst, err := packager.Push(app, opts.namespace, opts.tag, opts.repo)
2930
if err == nil {
3031
fmt.Println(dgst)
3132
}
@@ -34,5 +35,6 @@ func pushCmd() *cobra.Command {
3435
}
3536
cmd.Flags().StringVar(&opts.namespace, "namespace", "", "Namespace to use (default: namespace in metadata)")
3637
cmd.Flags().StringVarP(&opts.tag, "tag", "t", "", "Tag to use (default: version in metadata)")
38+
cmd.Flags().StringVar(&opts.repo, "repo", "", "Name of the remote repository (default: <app-name>.dockerapp)")
3739
return cmd
3840
}

e2e/commands_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ func testImage(registry string) func(*testing.T) {
283283
dir := fs.NewDir(t, "save-prepare-build", fs.WithFile("my.dockerapp", singleFileApp))
284284
defer dir.Remove()
285285
icmd.RunCommand(dockerApp, "push", "--namespace", registry+"/myuser", dir.Join("my.dockerapp")).Assert(t, icmd.Success)
286+
287+
icmd.RunCommand(dockerApp, "push", "-t", "marshmallows", "--namespace", registry+"/rainbows", "--repo", "unicorns", "render/envvariables").Assert(t, icmd.Success)
288+
AssertCommand(t, "docker", "image", "rm", registry+"/rainbows/unicorns:marshmallows")
289+
AssertCommandOutput(t, "image-inspect-labels.golden", "docker", "inspect", "-f", "{{.Config.Labels.maintainers}}", registry+"/rainbows/unicorns:marshmallows")
290+
icmd.RunCommand(dockerApp, "inspect", registry+"/rainbows/unicorns:marshmallows").Assert(t, icmd.Success)
291+
AssertCommand(t, dockerApp, "inspect", registry+"/rainbows/unicorns")
286292
}
287293
}
288294

0 commit comments

Comments
 (0)