-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Build only HTML and Save external version artifacts in different directory #5886
Build only HTML and Save external version artifacts in different directory #5886
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.
This is a bit of a quirk with how we run in production, but our build servers can't talk to the database. We need to find another way to send this information to the build servers and pass it along.
readthedocs/projects/models.py
Outdated
@@ -543,8 +543,13 @@ def get_storage_path(self, type_, version_slug=LATEST, include_file=True): | |||
:return: the path to an item in storage | |||
(can be used with ``storage.url`` to get the URL) | |||
""" | |||
type_dir = type_ | |||
# Add `external/` prefix for external versions | |||
if self.versions(manager=EXTERNAL).filter(slug=version_slug).exists(): |
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 believe this runs on the builders, so we can't query the DB for security reasons. We might need to think more about how we can pass this data to the builder. Can we set type_
differently coming in?
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.
@ericholscher We call this function in some other places also. if we change how _type
works then we have to check everywhere if the version is external or not then send the type accordingly and also we have to change how we get file extension
in that function. but a better way would be that we pass version_type
to the function and check it there (thought we have to handle it in all other places). What do you think we should do?
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.
Sure, we just need to capture that info somewhere and pass it along, instead of querying it. It's already passed into the build process somewhere right?
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.
Yes it is in available the build process. but I have to check other places we call this function :)
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.
This looks a lot better 👍
readthedocs/projects/models.py
Outdated
""" | ||
Get a path to a build artifact for use with Django's storage system. | ||
|
||
:param type_: Media content type, ie - 'pdf', 'htmlzip' | ||
:param version_slug: Project version slug for lookup | ||
:param version_type: Project version type |
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.
Wrong order. This should be last.
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.
Done!
No description provided.