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
galaxy: make retryable HTTP status codes configurable #82246
base: devel
Are you sure you want to change the base?
Conversation
First, not all those codes seem to be wise to add to 'retryable' list. Second, since that can vary by context, why not make this an option instead (defaulting to currrent list), so the user can configure the codes as they see fit? |
e09338e
to
f31915c
Compare
f31915c
to
c8a5d4d
Compare
try: | ||
retry_codes = [int(code) for code in C.GALAXY_RETRY_HTTP_ERROR_CODES] | ||
except ValueError as e: | ||
raise AnsibleError("Invalid value for HTTP retry code: %s. Only integer values are supported." % e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this should be handled here at all or if we assume they'll always be validated before. Just added just in case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this seems like too late for the validation. But if you do keep this, make sure to chain the exception cause explicitly.
try: | |
retry_codes = [int(code) for code in C.GALAXY_RETRY_HTTP_ERROR_CODES] | |
except ValueError as e: | |
raise AnsibleError("Invalid value for HTTP retry code: %s. Only integer values are supported." % e) | |
raise AnsibleError("Invalid value for HTTP retry code: %s. Only integer values are supported." % e) from e |
Thanks @bcoca @webknjaz, I added those initially as I saw 520 was on there which also doesn't necessarily mean retryable but I've removed them now 👍 I started adding a simple config item, would you be able to take another look if this is going in the right direction? Wasn't 100% sure on the config approach. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@webknjaz CI is green here but I'm not sure if there's anything else to for this PR before the next round of review? 🙇 |
|
||
|
||
def test_should_retry_error_with_invalid_code(monkeypatch): | ||
expected = "Invalid value for HTTP retry code" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's a regex, it'd be useful to be extra explicit about it:
expected = "Invalid value for HTTP retry code" | |
expected = r"^Invalid value for HTTP retry code: invalid\. Only integer values are supported\.$" |
- "429" # Too many requests | ||
- "520" # Galaxy rate limit error code (Cloudflare unknown error) | ||
- "502" # Common error from galaxy that may represent any number of transient backend issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really necessary to use string literals here?
- "429" # Too many requests | |
- "520" # Galaxy rate limit error code (Cloudflare unknown error) | |
- "502" # Common error from galaxy that may represent any number of transient backend issues | |
- 429 # Too many requests | |
- 520 # Galaxy rate limit error code (Cloudflare unknown error) | |
- 502 # Common error from galaxy that may represent any number of transient backend issues |
@nejch I'm mostly going through the CI queue to make sure no statuses are stuck and the CI is healthy. Sometimes GitHub thinks it didn't receive some status updates and it needs to be triggered again. Hence the restarts. You'll have to wait for somebody to do a functional review. |
SUMMARY
Extends the current list of server HTTP codes to retry client-side during galaxy installs, some of which have been listed in ansible/galaxy#3086 and the issues linked. This doesn't solve the root cause, which AFAIK should be resolved once Galaxy NG is ready. IMO these still make sense to be included by default but open to ideas.
This list is now similar to what we have in python-gitlab, which we've been extending based on feedback from users over the years:
https://github.com/python-gitlab/python-gitlab/blob/main/gitlab/const.py#L117
ISSUE TYPE
ADDITIONAL INFORMATION
For the full list of Cloudflare 52x status codes, see:
https://developers.cloudflare.com/support/troubleshooting/cloudflare-errors/troubleshooting-cloudflare-5xx-errors/#error-520-web-server-returns-an-unknown-error
/cc @dlouzan @fgreinacher