Skip to content

Commit

Permalink
Build: fail builds without configuration file or using v1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
humitos committed May 25, 2023
1 parent 931ba62 commit 9af3fd2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions readthedocs/doc_builder/director.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ def checkout(self):
self.data.build["config"] = self.data.config.as_dict()
self.data.build["readthedocs_yaml_path"] = custom_config_file

# Raise a build error if the project is not using a config file or using v1
if self.data.project.has_feature(
Feature.NO_CONFIG_FILE_DEPRECATED
) and self.data.config.version not in ("2", 2):
raise BuildUserError(BuildUserError.NO_CONFIG_FILE_DEPRECATED)

if self.vcs_repository.supports_submodules:
self.vcs_repository.update_submodules(self.data.config)

Expand Down
5 changes: 5 additions & 0 deletions readthedocs/doc_builder/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class BuildUserError(BuildBaseException):
"Ensure your project is configured to use the output path "
"'$READTHEDOCS_OUTPUT/html' instead."
)
NO_CONFIG_FILE_DEPRECATED = gettext_noop(
"Not using a '.readthedocs.yaml' configuration file is deprecated. "
"Add a configuration file to your project to make it build successfully. "
"Read more at https://docs.readthedocs.io/en/stable/config-file/v2.html"
)


class BuildUserSkip(BuildUserError):
Expand Down
5 changes: 5 additions & 0 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1915,6 +1915,7 @@ def add_features(sender, **kwargs):
DONT_CREATE_INDEX = "dont_create_index"
USE_RCLONE = "use_rclone"
HOSTING_INTEGRATIONS = "hosting_integrations"
NO_CONFIG_FILE_DEPRECATED = "no_config_file"

FEATURES = (
(ALLOW_DEPRECATED_WEBHOOKS, _("Webhook: Allow deprecated webhook views")),
Expand Down Expand Up @@ -2111,6 +2112,10 @@ def add_features(sender, **kwargs):
"Proxito: Inject 'readthedocs-client.js' as <script> HTML tag in responses."
),
),
(
NO_CONFIG_FILE_DEPRECATED,
_("Build: Building without a configuration file is deprecated."),
),
)

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

0 comments on commit 9af3fd2

Please sign in to comment.