Skip to content

Commit

Permalink
Podman push --all-tags option
Browse files Browse the repository at this point in the history
Task for containers#14917

Podman will now push all tags for a given image
when -a or --all-tags is specified.
  • Loading branch information
byarbrough committed Jul 15, 2022
1 parent b4c09be commit ca05368
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmd/podman/images/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func init() {
func pushFlags(cmd *cobra.Command) {
flags := cmd.Flags()

// For now default All flag to true, for pushing of manifest lists
pushOptions.All = true
flags.BoolVarP(&pushOptions.All, "all-tags", "a", false, "Push all tagged images in the repository")

authfileFlagName := "authfile"
flags.StringVar(&pushOptions.Authfile, authfileFlagName, auth.GetDefaultAuthFile(), "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override")
_ = cmd.RegisterFlagCompletionFunc(authfileFlagName, completion.AutocompleteDefault)
Expand Down
8 changes: 8 additions & 0 deletions docs/source/markdown/podman-push.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ $ podman push myimage oci-archive:/tmp/myimage

## OPTIONS

#### **--all-tags**, **-a**

Push all tags for a given image to the repository. When using this flag, do not specify a tag for the DESTINATION.

#### **--authfile**=*path*

Path of the authentication file. Default is ${XDG\_RUNTIME\_DIR}/containers/auth.json, which is set using `podman login`.
Expand Down Expand Up @@ -121,6 +125,10 @@ This example pushes the image specified by the imageID to a container registry n

`# podman push imageID docker://registry.example.com/repository:tag`

This example pushes all tags for the image specified by the imageID to a container registry named registry.example.com

`# podman push --all-tags imageID docker://registry.example.com/repository`

This example pushes the image specified by the imageID to a container registry named registry.example.com and saves the digest in the specified digestfile.

`# podman push --digestfile=/tmp/mydigest imageID docker://registry.example.com/repository:tag`
Expand Down
1 change: 1 addition & 0 deletions pkg/domain/infra/abi/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri
pushOptions.RemoveSignatures = options.RemoveSignatures
pushOptions.SignBy = options.SignBy
pushOptions.InsecureSkipTLSVerify = options.SkipTLSVerify
pushOptions.AllTags = options.All

compressionFormat := options.CompressionFormat
if compressionFormat == "" {
Expand Down
10 changes: 7 additions & 3 deletions test/e2e/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,18 @@ var _ = Describe("Podman push", func() {
push.WaitWithDefaultTimeout()
Expect(push).Should(Exit(0))

pushA := podmanTest.Podman([]string{"push", "-q", "-a", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
pushA.WaitWithDefaultTimeout()
Expect(pushA).Should(Exit(0))

SkipIfRemote("Remote does not support --digestfile")
// Test --digestfile option
push2 := podmanTest.Podman([]string{"push", "--tls-verify=false", "--digestfile=/tmp/digestfile.txt", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
push2.WaitWithDefaultTimeout()
pushD := podmanTest.Podman([]string{"push", "--tls-verify=false", "--digestfile=/tmp/digestfile.txt", "--remove-signatures", ALPINE, "localhost:5000/my-alpine"})
pushD.WaitWithDefaultTimeout()
fi, err := os.Lstat("/tmp/digestfile.txt")
Expect(err).To(BeNil())
Expect(fi.Name()).To(Equal("digestfile.txt"))
Expect(push2).Should(Exit(0))
Expect(pushD).Should(Exit(0))
})

It("podman push to local registry with authorization", func() {
Expand Down
32 changes: 32 additions & 0 deletions vendor/github.com/containers/common/libimage/push.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ca05368

Please sign in to comment.