Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] Podman push --all-tags option #14949

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should still be defaulted to true.


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.