Skip to content

Commit

Permalink
Merge pull request #25352 from baude/artifactpullretrydelay
Browse files Browse the repository at this point in the history
wire up --retry-delay for artifact pull
  • Loading branch information
openshift-merge-bot[bot] authored Feb 19, 2025
2 parents 61e88e4 + 6ad2dc0 commit 080a239
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
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 @@ -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())

Expand Down

0 comments on commit 080a239

Please sign in to comment.