mirror of https://github.com/containers/podman.git
[v5.4-rhel] wire up --retry-delay for artifact pull
fixed a bug in the artifact code where --retry-delay was being discarded. Fixes: https://issues.redhat.com/browse/RUN-2511 Fixes: https://issues.redhat.com/browse/RHEL-80259, https://issues.redhat.com/browse/RHEL-80260 Signed-off-by: Brent Baude <bbaude@redhat.com> Signed-off-by: tomsweeneyredhat <tsweeney@redhat.com>
This commit is contained in:
parent
67d3d0788c
commit
56bfad1b0d
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
||||
|
|
Loading…
Reference in New Issue