Skip to content

Commit

Permalink
Run FileTreeDiff indexer on all versions in dev (#11873)
Browse files Browse the repository at this point in the history
This allows easier support for working on this locally,
and runs it against all active verisons.

---------

Co-authored-by: Manuel Kaufmann <[email protected]>
  • Loading branch information
ericholscher and humitos authored Jan 21, 2025
1 parent 795e6a1 commit 836cf22
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/dev/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ Use this storage class to upload build artifacts to cloud storage (S3, Azure sto
This should be a dotted path to the relevant class (eg. ``'path.to.MyBuildMediaStorage'``).
Your class should mixin :class:`readthedocs.builds.storage.BuildMediaStorageMixin`.

RTD_FILETREEDIFF_ALL
--------------------

Set to ``True`` to enable the file tree diff feature for all projects.


ELASTICSEARCH_DSL
-----------------
Expand Down
5 changes: 4 additions & 1 deletion readthedocs/projects/tasks/search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from fnmatch import fnmatch

import structlog
from django.conf import settings

from readthedocs.builds.constants import BUILD_STATE_FINISHED, INTERNAL, LATEST
from readthedocs.builds.models import Build, Version
Expand Down Expand Up @@ -172,7 +173,9 @@ def _get_indexers(*, version: Version, build: Build, search_index_name=None):
else LATEST
)
create_manifest = version.project.addons.filetreediff_enabled and (
version.is_external or version.slug == base_version
version.is_external
or version.slug == base_version
or settings.RTD_FILETREEDIFF_ALL
)
if create_manifest:
file_manifest_indexer = FileManifestIndexer(
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/proxito/views/hosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ def _get_filetreediff_response(self, *, request, project, version, resolver):
This response is only enabled for external versions,
we do the comparison between the current version and the latest version.
"""
if not version.is_external:
if not version.is_external and not settings.RTD_FILETREEDIFF_ALL:
return None

if not project.addons.filetreediff_enabled:
Expand Down
3 changes: 3 additions & 0 deletions readthedocs/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class CommunityBaseSettings(Settings):
DEBUG = True
RTD_FORCE_SHOW_DEBUG_TOOLBAR = False

# Build FTD index for all versions
RTD_FILETREEDIFF_ALL = False

@property
def DEBUG_TOOLBAR_CONFIG(self):
def _show_debug_toolbar(request):
Expand Down
2 changes: 2 additions & 0 deletions readthedocs/settings/docker_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,5 +239,7 @@ def SOCIALACCOUNT_PROVIDERS(self):
DATA_UPLOAD_MAX_NUMBER_FIELDS = None
SUPPORT_EMAIL = "[email protected]"

RTD_FILETREEDIFF_ALL = "RTD_FILETREEDIFF_ALL" in os.environ


DockerBaseSettings.load_settings(__name__)

0 comments on commit 836cf22

Please sign in to comment.