diff --git a/readthedocs/projects/tasks/builds.py b/readthedocs/projects/tasks/builds.py index 41d79b11c9d..9e409f91263 100644 --- a/readthedocs/projects/tasks/builds.py +++ b/readthedocs/projects/tasks/builds.py @@ -574,24 +574,13 @@ def get_valid_artifact_types(self): if artifact_type == "html": index_html_filepath = os.path.join(artifact_directory, "index.html") - readme_html_filepath = os.path.join(artifact_directory, "README.html") - if not os.path.exists(index_html_filepath) and not os.path.exists( - readme_html_filepath - ): - log.warning( + if not os.path.exists(index_html_filepath): + log.info( "Failing the build. " "HTML output does not contain an 'index.html' at its root directory.", index_html=index_html_filepath, - readme_html=readme_html_filepath, ) - # TODO: uncomment this line to fail the build once we have - # communicated with projects without an index.html or - # README.html - # - # NOTE: we want to deprecate serving README.html as an - # index.html file as well. - # - # raise BuildUserError(BuildUserError.BUILD_OUTPUT_HTML_NO_INDEX_FILE) + raise BuildUserError(BuildUserError.BUILD_OUTPUT_HTML_NO_INDEX_FILE) if not os.path.exists(artifact_directory): # There is no output directory. diff --git a/readthedocs/projects/tests/test_build_tasks.py b/readthedocs/projects/tests/test_build_tasks.py index a69f9c19b6c..547da8c42e3 100644 --- a/readthedocs/projects/tests/test_build_tasks.py +++ b/readthedocs/projects/tests/test_build_tasks.py @@ -294,6 +294,14 @@ def test_build_updates_documentation_type(self, load_yaml_config): ) ).touch() + # Create an "index.html" at root to avoid failing the builds + pathlib.Path( + os.path.join( + self.project.artifact_path(version=self.version.slug, type_="html"), + "index.html", + ) + ).touch() + self._trigger_update_docs_task() # Update version state @@ -438,6 +446,14 @@ def test_successful_build( ) ).touch() + # Create an "index.html" at root to avoid failing the builds + pathlib.Path( + os.path.join( + self.project.artifact_path(version=self.version.slug, type_="html"), + "index.html", + ) + ).touch() + self._trigger_update_docs_task() # It has to be called twice, ``before_start`` and ``after_return``