Skip to content

Commit cbdf5b5

Browse files
authored
Merge pull request #5109 from rtfd/humitos/feature-flag-testing-image
Feature flag to use `readthedocs/build:testing` image
2 parents a071a81 + a76956e commit cbdf5b5

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

readthedocs/doc_builder/environments.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from readthedocs.builds.models import BuildCommandResultMixin
3333
from readthedocs.core.utils import slugify
3434
from readthedocs.projects.constants import LOG_TEMPLATE
35+
from readthedocs.projects.models import Feature
3536
from readthedocs.restapi.client import api as api_v2
3637

3738
from .constants import (
@@ -726,10 +727,18 @@ def __init__(self, *args, **kwargs):
726727
project_name=self.project.slug,
727728
)[:DOCKER_HOSTNAME_MAX_LEN],
728729
)
730+
731+
# Decide what Docker image to use, based on priorities:
732+
# Use the Docker image set by our feature flag: ``testing`` or,
733+
if self.project.has_feature(Feature.USE_TESTING_BUILD_IMAGE):
734+
self.container_image = 'readthedocs/build:testing'
735+
# the image set by user or,
729736
if self.config and self.config.build.image:
730737
self.container_image = self.config.build.image
738+
# the image overridden by the project (manually set by an admin).
731739
if self.project.container_image:
732740
self.container_image = self.project.container_image
741+
733742
if self.project.container_mem_limit:
734743
self.container_mem_limit = self.project.container_mem_limit
735744
if self.project.container_time_limit:

readthedocs/projects/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,7 @@ def add_features(sender, **kwargs):
10101010
ALLOW_V2_CONFIG_FILE = 'allow_v2_config_file'
10111011
MKDOCS_THEME_RTD = 'mkdocs_theme_rtd'
10121012
DONT_SHALLOW_CLONE = 'dont_shallow_clone'
1013+
USE_TESTING_BUILD_IMAGE = 'use_testing_build_image'
10131014

10141015
FEATURES = (
10151016
(USE_SPHINX_LATEST, _('Use latest version of Sphinx')),
@@ -1024,6 +1025,8 @@ def add_features(sender, **kwargs):
10241025
(MKDOCS_THEME_RTD, _('Use Read the Docs theme for MkDocs as default theme')),
10251026
(DONT_SHALLOW_CLONE, _(
10261027
'Do not shallow clone when cloning git repos')),
1028+
(USE_TESTING_BUILD_IMAGE, _(
1029+
'Use Docker image labelled as `testing` to build the docs')),
10271030
)
10281031

10291032
projects = models.ManyToManyField(

0 commit comments

Comments
 (0)