From e129b330d453414056385466b063c44f8c917078 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 12 May 2020 14:19:01 -0700 Subject: [PATCH 1/2] Fix PR builds being marked built This was removed in https://github.com/readthedocs/readthedocs.org/pull/7044, and it's needed to properly link to the PR builds and update their status. --- readthedocs/projects/tasks.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index 48d9e94d8ab..06ccde4300f 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -787,14 +787,13 @@ def run_build(self, record): # We upload EXTERNAL version media files to blob storage # We should have this check here to make sure # the files don't get re-uploaded on web. - if self.version.type != EXTERNAL: - self.update_app_instances( - html=bool(outcomes['html']), - search=bool(outcomes['search']), - localmedia=bool(outcomes['localmedia']), - pdf=bool(outcomes['pdf']), - epub=bool(outcomes['epub']), - ) + self.update_app_instances( + html=bool(outcomes['html']), + search=bool(outcomes['search']), + localmedia=bool(outcomes['localmedia']), + pdf=bool(outcomes['pdf']), + epub=bool(outcomes['epub']), + ) else: log.warning('No build ID, not syncing files') @@ -1114,9 +1113,6 @@ def update_app_instances( 'Updating version failed, skipping file sync: version=%s', self.version, ) - hostname = socket.gethostname() - - delete_unsynced_media = True # Broadcast finalization steps to web application instances fileify.delay( @@ -1272,7 +1268,7 @@ def fileify(version_pk, commit, build): This is so we have an idea of what files we have in the database. """ version = Version.objects.get_object_or_log(pk=version_pk) - if not version: + if not version or version.type == EXTERNAL: return project = version.project From 90ac6731442570fa1a8bc7514114e57e25e95203 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Tue, 12 May 2020 14:27:19 -0700 Subject: [PATCH 2/2] Fix comments --- readthedocs/projects/tasks.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/readthedocs/projects/tasks.py b/readthedocs/projects/tasks.py index 06ccde4300f..79df64cfb6d 100644 --- a/readthedocs/projects/tasks.py +++ b/readthedocs/projects/tasks.py @@ -783,10 +783,7 @@ def run_build(self, record): epub=bool(outcomes['epub']), ) - # Finalize build and update web servers - # We upload EXTERNAL version media files to blob storage - # We should have this check here to make sure - # the files don't get re-uploaded on web. + # TODO: Remove this function and just update the DB and index search directly self.update_app_instances( html=bool(outcomes['html']), search=bool(outcomes['search']), @@ -1268,6 +1265,7 @@ def fileify(version_pk, commit, build): This is so we have an idea of what files we have in the database. """ version = Version.objects.get_object_or_log(pk=version_pk) + # Don't index external version builds for now if not version or version.type == EXTERNAL: return project = version.project