diff --git a/cmd/podman/artifact/pull.go b/cmd/podman/artifact/pull.go index 4d6853fbab..68db8773e2 100644 --- a/cmd/podman/artifact/pull.go +++ b/cmd/podman/artifact/pull.go @@ -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 { diff --git a/pkg/domain/infra/abi/artifact.go b/pkg/domain/infra/abi/artifact.go index a65e40f7cf..cea9c791ca 100644 --- a/pkg/domain/infra/abi/artifact.go +++ b/pkg/domain/infra/abi/artifact.go @@ -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 diff --git a/test/e2e/artifact_test.go b/test/e2e/artifact_test.go index dba86eb931..b738ff5cbb 100644 --- a/test/e2e/artifact_test.go +++ b/test/e2e/artifact_test.go @@ -130,6 +130,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())