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

fix: Detect sentry-cli version for relative endpoint use in ChunkUploadEndpoint #29477

Merged
merged 2 commits into from
Oct 21, 2021

Conversation

kamilogorek
Copy link
Contributor

@kamilogorek kamilogorek commented Oct 21, 2021

Prior to sentry-cli 1.70.1 we issued a warning about usage of relative URLs for chunked uploads. Because we changed it in the Sentry itself, it was issued for every user of sentry-cli, that do not override their on-premise system.upload-url-prefix config. We did remove this warning in 1.70.1, and it's only the log message, however, we do count it as a regression and would rather patch it here as well.

Note: There is no generic semver parser available in our codebase, and there is no need to pull additional package to do this here.

ref: getsentry/sentry-cli#1054 (review)
ref: #29347

@kamilogorek kamilogorek requested review from jan-auer and a team October 21, 2021 10:36
Comment on lines +59 to +61
and (int(sentrycli_version.group("major")) >= 1)
and (int(sentrycli_version.group("minor")) >= 70)
and (int(sentrycli_version.group("patch")) >= 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: to me this looks more pythonic as (v.group('major'), v.group('minor'), v.group('patch')) >= (1, 70, 1), but i think it's functionally equivalent so doesn't really matter

Copy link
Contributor Author

@kamilogorek kamilogorek Oct 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It ends up being formatted as

supports_relative_url = (sentrycli_version is not None) and (
    (
        int(sentrycli_version.group("major")),
        int(sentrycli_version.group("minor")),
        int(sentrycli_version.group("patch")),
    )
    >= (1, 70, 1)
)

which is kinda ugly. Even with shorter name its still "meh", especially that we need to cast it.

@kamilogorek kamilogorek enabled auto-merge (squash) October 21, 2021 11:47
@kamilogorek kamilogorek merged commit 0ac0f8c into master Oct 21, 2021
@kamilogorek kamilogorek deleted the chunk-endpoint-conditions branch October 21, 2021 12:08
@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants