-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fall back to _x filename for beta release notes #1455
Conversation
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.
I'm good with this, please ping Brian or Dave to get it reviewed. I want this to get in the merge today
settings.STATIC_CONTENT_BUCKET_NAME, | ||
f"release-notes/master/{filename}.adoc", | ||
) | ||
s3_client = get_s3_client() |
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.
I'd think we should tweak this so we have a set of alternative strings/formats checked in a while loop, that way there's flexibility for adding new ones in the future, and we only have the call code once.
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.
I considered this, but
- I wasn't really sure what other patterns might exist, making it a bit difficult to generalize, and
- YAGNI - I figured we could add this once we have more than two known possible patterns
If you think we should still add this now, I'm open to doing so, though we will still need a code change to at a minimum add the third pattern if it crops up. LMK your thoughts.
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.
Personally I'd have it not repeat the code in both places, but it will work as is so I've approved the PR.
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.
Fair - I have a feeling we'll be revisiting this code, and I'll keep this in mind. I'm going to add a TODO comment but merge this as-is for now. Thanks Dave!
try: | ||
response = session.get(url) | ||
if response.status_code == 404: |
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.
same here, with the try catch inside the while
Follow-up fix for #1171
It turns out the newest beta release notes have been named
version_1_87_x.html
instead of the expectedversion_1_87_0.html
name. This PR creates a fallback strategy that first attempts the_0
filename, then tries_x
if the former results in a 404 response.Manual testing
I wasn't able to successfully test the S3 version of the function, since the beta release notes do not yet appear to be in S3.
For the GitHub version, I added a print statement for debug purposes to indicate we were hitting the fallback url with the
_x
filename suffix.