Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature flag to use readthedocs/build:testing image #5109

Merged
merged 2 commits into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions readthedocs/doc_builder/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from readthedocs.builds.models import BuildCommandResultMixin
from readthedocs.core.utils import slugify
from readthedocs.projects.constants import LOG_TEMPLATE
from readthedocs.projects.models import Feature
from readthedocs.restapi.client import api as api_v2

from .constants import (
Expand Down Expand Up @@ -726,10 +727,18 @@ def __init__(self, *args, **kwargs):
project_name=self.project.slug,
)[:DOCKER_HOSTNAME_MAX_LEN],
)

# Decide what Docker image to use, based on priorities:
# Use the Docker image set by our feature flag: ``testing`` or,
if self.project.has_feature(Feature.USE_TESTING_BUILD_IMAGE):
self.container_image = 'readthedocs/build:testing'
# the image set by user or,
if self.config and self.config.build.image:
self.container_image = self.config.build.image
# the image overridden by the project (manually set by an admin).
if self.project.container_image:
self.container_image = self.project.container_image
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wonder if this should be before the users config? I can see reasons for both, but having our DB entry overwrite the users wishes seems really confusing.

Copy link
Member

@stsewd stsewd Jan 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm ok. I guess the DB setting makes a bit of sense to overwrite, but not a feature flag for testing.


if self.project.container_mem_limit:
self.container_mem_limit = self.project.container_mem_limit
if self.project.container_time_limit:
Expand Down
3 changes: 3 additions & 0 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,7 @@ def add_features(sender, **kwargs):
ALLOW_V2_CONFIG_FILE = 'allow_v2_config_file'
MKDOCS_THEME_RTD = 'mkdocs_theme_rtd'
DONT_SHALLOW_CLONE = 'dont_shallow_clone'
USE_TESTING_BUILD_IMAGE = 'use_testing_build_image'

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

projects = models.ManyToManyField(
Expand Down