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

impl: add a retry with result function #2837

Merged
merged 2 commits into from
Nov 10, 2023

Conversation

alevenberg
Copy link
Contributor

@alevenberg alevenberg commented Nov 9, 2023

First part of the attempt to fix #1717

Description

This is 1/2 PRs. In the 2nd PR, I want to add a retry loop to remoteImageFunc. This PR adds a function to retry when there is a return value.

Submitter Checklist

  • Includes unit tests
    - [ ] Adds integration tests if needed.

Tested using go test pkg/util/util_test.go pkg/util/util.go

I tried make test but was getting failures on the main branch in unrelated tests, e.g.

coverage: 10.5% of statements
ok      github.com/GoogleContainerTools/kaniko/pkg/util/proc    0.027s  coverage: 10.5% of statements
FAIL
make: *** [Makefile:67: test] Error 1

Reviewer Notes

  • The code flow looks good.
  • Unit tests and or integration tests added.

Note: this is my first time using go in a while, if there are any readability changes I could make, please let me know!

@aaron-prindle
Copy link
Collaborator

aaron-prindle commented Nov 9, 2023

Thanks for the PR @alevenberg! From the CI tests it looks like there are two linter errors to resolve:
https://github.com/GoogleContainerTools/kaniko/actions/runs/6814541622/job/18539118689?pr=2837

gofmt these 2 files

Gofmt errors in files:
./pkg/util/util.go
./pkg/util/util_test.go
...

update this line in util.go

Error: pkg/util/util.go:218:106: non-wrapping format verb for fmt.Errorf. Use `%w` to format errors (errorlint)
	return result, fmt.Errorf("unable to complete operation after %d attempts, last error: %v", retryCount, err)

Once these are resolved, the PR itself looks good and we should be able to merge

@alevenberg
Copy link
Contributor Author

Made the changes.

Ran the following to format the files.

gofmt -l -s -w pkg/util/util.go
gofmt -l -s -w pkg/util/util_test.go

@alevenberg
Copy link
Contributor Author

Thanks for taking a look @aaron-prindle

@aaron-prindle aaron-prindle merged commit 5133ad8 into GoogleContainerTools:main Nov 10, 2023
10 checks passed
alevenberg added a commit to alevenberg/kaniko that referenced this pull request Nov 10, 2023
* impl: add a retry with result function

* fix ci errs
alevenberg added a commit to alevenberg/kaniko that referenced this pull request Nov 14, 2023
* impl: add a retry with result function

* fix ci errs
alevenberg added a commit to alevenberg/kaniko that referenced this pull request Nov 14, 2023
* impl: add a retry with result function

* fix ci errs
alevenberg added a commit to alevenberg/kaniko that referenced this pull request Nov 14, 2023
* impl: add a retry with result function

* fix ci errs
alevenberg added a commit to alevenberg/kaniko that referenced this pull request Nov 14, 2023
* impl: add a retry with result function

* fix ci errs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

failed to get filesystem from image: connection reset by peer
2 participants