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

[v5.4] wire up --retry-delay for artifact pull #25364

Open
wants to merge 1 commit into
base: v5.4
Choose a base branch
from
Open
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
22 changes: 0 additions & 22 deletions cmd/podman/artifact/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,28 +116,6 @@ func artifactPull(cmd *cobra.Command, args []string) error {
}
}

// TODO Once we have a decision about the flag removal above, this should be safe to delete
/*
platform, err := cmd.Flags().GetString("platform")
if err != nil {
return err
}
if platform != "" {
if pullOptions.Arch != "" || pullOptions.OS != "" {
return errors.New("--platform option can not be specified with --arch or --os")
}

specs := strings.Split(platform, "/")
pullOptions.OS = specs[0] // may be empty
if len(specs) > 1 {
pullOptions.Arch = specs[1]
if len(specs) > 2 {
pullOptions.Variant = specs[2]
}
}
}
*/

if pullOptions.CredentialsCLI != "" {
creds, err := util.ParseRegistryCreds(pullOptions.CredentialsCLI)
if err != nil {
Expand Down
8 changes: 7 additions & 1 deletion pkg/domain/infra/abi/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,18 @@ func (ir *ImageEngine) ArtifactPull(ctx context.Context, name string, opts entit
pullOptions.CertDirPath = opts.CertDirPath
pullOptions.Username = opts.Username
pullOptions.Password = opts.Password
// pullOptions.Architecture = opts.Arch
pullOptions.SignaturePolicyPath = opts.SignaturePolicyPath
pullOptions.InsecureSkipTLSVerify = opts.InsecureSkipTLSVerify
pullOptions.Writer = opts.Writer
pullOptions.OciDecryptConfig = opts.OciDecryptConfig
pullOptions.MaxRetries = opts.MaxRetries
if opts.RetryDelay != "" {
duration, err := time.ParseDuration(opts.RetryDelay)
if err != nil {
return nil, err
}
pullOptions.RetryDelay = &duration
}

if !opts.Quiet && pullOptions.Writer == nil {
pullOptions.Writer = os.Stderr
Expand Down
7 changes: 7 additions & 0 deletions test/e2e/artifact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ var _ = Describe("Podman artifact", func() {
})

It("podman artifact push and pull", func() {
// Before starting a registry, try to pull a bogus image from a bogus registry
// using retry-delay
retrySession := podmanTest.Podman([]string{"artifact", "pull", "--retry", "1", "--retry-delay", "100ms", "127.0.0.1/mybadimagename"})
retrySession.WaitWithDefaultTimeout()
Expect(retrySession).Should(ExitWithError(125, "connect: connection refused"))
Expect(retrySession.ErrorToString()).To(ContainSubstring("retrying in 100ms ..."))

artifact1File, err := createArtifactFile(1024)
Expect(err).ToNot(HaveOccurred())

Expand Down