Skip to content

Commit fd4a995

Browse files
committed
Run checkout inside docker
The title isn't 100% true, because it depends on the settings (if docker is enabled). There are still commands being executed outside docker readthedocs#5673.
1 parent 7ff87c2 commit fd4a995

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

readthedocs/projects/tasks.py

+9-13
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def __init__(
342342

343343
# pylint: disable=arguments-differ
344344
def run(
345-
self, pk, version_pk=None, build_pk=None, record=True, docker=None,
345+
self, pk, version_pk=None, build_pk=None, record=True,
346346
force=False, **__
347347
):
348348
"""
@@ -365,18 +365,13 @@ def run(
365365
:param version_pk int: Project Version id (latest if None)
366366
:param build_pk int: Build id (if None, commands are not recorded)
367367
:param record bool: record a build object in the database
368-
:param docker bool: use docker to build the project (if ``None``,
369-
``settings.DOCKER_ENABLE`` is used)
370368
:param force bool: force Sphinx build
371369
372370
:returns: whether build was successful or not
373371
374372
:rtype: bool
375373
"""
376374
try:
377-
if docker is None:
378-
docker = settings.DOCKER_ENABLE
379-
380375
self.project = self.get_project(pk)
381376
self.version = self.get_version(self.project, version_pk)
382377
self.build = self.get_build(build_pk)
@@ -418,7 +413,7 @@ def run(
418413
# No exceptions in the setup step, catch unhandled errors in the
419414
# build steps
420415
try:
421-
self.run_build(docker=docker, record=record)
416+
self.run_build(record=record)
422417
except Exception as e: # noqa
423418
log.exception(
424419
'An unhandled exception was raised during project build',
@@ -451,7 +446,11 @@ def run_setup(self, record=True):
451446
452447
Return True if successful.
453448
"""
454-
self.setup_env = LocalBuildEnvironment(
449+
if settings.DOCKER_ENABLE:
450+
env_cls = DockerBuildEnvironment
451+
else:
452+
env_cls = LocalBuildEnvironment
453+
self.setup_env = env_cls(
455454
project=self.project,
456455
version=self.version,
457456
build=self.build,
@@ -517,19 +516,16 @@ def additional_vcs_operations(self):
517516
if version_repo.supports_submodules:
518517
version_repo.update_submodules(self.config)
519518

520-
def run_build(self, docker, record):
519+
def run_build(self, record):
521520
"""
522521
Build the docs in an environment.
523522
524-
:param docker: if ``True``, the build uses a ``DockerBuildEnvironment``,
525-
otherwise it uses a ``LocalBuildEnvironment`` to run all the
526-
commands to build the docs
527523
:param record: whether or not record all the commands in the ``Build``
528524
instance
529525
"""
530526
env_vars = self.get_env_vars()
531527

532-
if docker:
528+
if settings.DOCKER_ENABLE:
533529
env_cls = DockerBuildEnvironment
534530
else:
535531
env_cls = LocalBuildEnvironment

readthedocs/rtd_tests/tests/test_config_integration.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def test_conda_environment(self, build_failed, checkout_path, tmpdir):
457457
)
458458

459459
update_docs = self.get_update_docs_task()
460-
update_docs.run_build(docker=False, record=False)
460+
update_docs.run_build(record=False)
461461

462462
conda_file = path.join(str(base_path), conda_file)
463463
assert update_docs.config.conda.environment == conda_file

0 commit comments

Comments
 (0)