Skip to content

Commit 9af3fd2

Browse files
committed
Build: fail builds without configuration file or using v1
Use a feature flag to decide whether or not hard fail the builds that are not using a configuration file at all or are using v1. This will be useful in the future when we want to make the builds to fail during a reduced period of time to inform users/customers about this deprecation. Related #10351
1 parent 931ba62 commit 9af3fd2

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

readthedocs/doc_builder/director.py

+6
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ def checkout(self):
238238
self.data.build["config"] = self.data.config.as_dict()
239239
self.data.build["readthedocs_yaml_path"] = custom_config_file
240240

241+
# Raise a build error if the project is not using a config file or using v1
242+
if self.data.project.has_feature(
243+
Feature.NO_CONFIG_FILE_DEPRECATED
244+
) and self.data.config.version not in ("2", 2):
245+
raise BuildUserError(BuildUserError.NO_CONFIG_FILE_DEPRECATED)
246+
241247
if self.vcs_repository.supports_submodules:
242248
self.vcs_repository.update_submodules(self.data.config)
243249

readthedocs/doc_builder/exceptions.py

+5
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ class BuildUserError(BuildBaseException):
5757
"Ensure your project is configured to use the output path "
5858
"'$READTHEDOCS_OUTPUT/html' instead."
5959
)
60+
NO_CONFIG_FILE_DEPRECATED = gettext_noop(
61+
"Not using a '.readthedocs.yaml' configuration file is deprecated. "
62+
"Add a configuration file to your project to make it build successfully. "
63+
"Read more at https://docs.readthedocs.io/en/stable/config-file/v2.html"
64+
)
6065

6166

6267
class BuildUserSkip(BuildUserError):

readthedocs/projects/models.py

+5
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,7 @@ def add_features(sender, **kwargs):
19151915
DONT_CREATE_INDEX = "dont_create_index"
19161916
USE_RCLONE = "use_rclone"
19171917
HOSTING_INTEGRATIONS = "hosting_integrations"
1918+
NO_CONFIG_FILE_DEPRECATED = "no_config_file"
19181919

19191920
FEATURES = (
19201921
(ALLOW_DEPRECATED_WEBHOOKS, _("Webhook: Allow deprecated webhook views")),
@@ -2111,6 +2112,10 @@ def add_features(sender, **kwargs):
21112112
"Proxito: Inject 'readthedocs-client.js' as <script> HTML tag in responses."
21122113
),
21132114
),
2115+
(
2116+
NO_CONFIG_FILE_DEPRECATED,
2117+
_("Build: Building without a configuration file is deprecated."),
2118+
),
21142119
)
21152120

21162121
FEATURES = sorted(FEATURES, key=lambda l: l[1])

0 commit comments

Comments
 (0)