libimage: implement retry logic for manifest push#1666
libimage: implement retry logic for manifest push#1666openshift-merge-robot merged 1 commit intocontainers:mainfrom
retry logic for manifest push#1666Conversation
9391ce7 to
b28613f
Compare
libimage/manifests/manifests.go
Outdated
|
|
||
| const ( | ||
| defaultMaxRetries = 3 | ||
| defaultRetryDelay = time.Second |
There was a problem hiding this comment.
retry.IfNecessary() has a default for this, so it's better to not insert our own.
There was a problem hiding this comment.
image push retries for 3 times with a delay of 1 second which is hardcoded in libimage/copier but I was unable to find these defaults in retry package https://github.com/containers/common/blob/main/pkg/retry/retry.go
There was a problem hiding this comment.
There's a default delay (the godoc for retry.Options.Delay hints at it), but not a default on the number of retries.
b28613f to
f6455a2
Compare
f6455a2 to
ab58b4f
Compare
ab58b4f to
061f2b0
Compare
061f2b0 to
48a8fa2
Compare
libimage/manifests/manifests_test.go
Outdated
|
|
||
| options.RetryDelay = 3 * time.Second | ||
| _, _, err = list.Push(ctx, destRef, options) | ||
| assert.NoError(t, err, "list.Push(with RetryDelay)") |
There was a problem hiding this comment.
Is this expected to be testing the new fields in options in combination with the other settings that were already set above? Is it verifying that the new options cause any changes in behavior?
There was a problem hiding this comment.
@nalind Yes this is only testing field, I expect to do integration test where retry is happening on podman side where it throws warning on every failed retry attempt and success on push to registry.
nalind
left a comment
There was a problem hiding this comment.
TestPush() really needs to be expanded, but otherwise LGTM, give or take a non-blocking stylistic nit.
|
Let me extend the test, I think this can be tested here as well. |
699fa23 to
6d13884
Compare
|
Expanded PushTest to actually cover retry attempts by checking |
6d13884 to
0dffc5f
Compare
|
@nalind PTAL again. |
libimage/manifests/manifests_test.go
Outdated
| assert.Nilf(t, err, "list.Push(four specified)") | ||
|
|
||
| bogusDestRef, err := alltransports.ParseImageName("docker://localhost/bogus/dest:latest") | ||
| assert.Nilf(t, err, "ParseImageName()") |
There was a problem hiding this comment.
Probably want to use assert.NoErrorf() here, since we know that err is an error if it isn't nil.
nalind
left a comment
There was a problem hiding this comment.
LGTM with one minor change to the TestPushManifest() test.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flouthoc, giuseppe, nalind, vrothberg The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
manifest push API must implement and leverage `retry` logic similar to `image push` with similar defaults. Closes: containers#1664 Signed-off-by: Aditya R <arajan@redhat.com>
0dffc5f to
c044f8d
Compare
|
/lgtm |
Test: containers/common#1666 Signed-off-by: Aditya R <arajan@redhat.com>
manifest push API must implement and leverage
retrylogic similar toimage pushwith similar defaults.Closes: #1664