Skip to content

Commit 755c636

Browse files
committed
Execute checkout step respecting docker setting
Closes readthedocs#5673 There is a couple of things with this: - Git commands using gitpython will use the git binary from the host - Git commands using git directly, will use the git binary from the container. This may bring some surprises, since the git versions will be different. But I'm not really worried about it, it should work. Another thing is: To make a clone we will spin a build image, which are big, probably we could add an image that only has git in it. This should be merged after we have integrated this with the ssh-agent in .com
1 parent 79891bb commit 755c636

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

readthedocs/projects/tasks.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -347,17 +347,17 @@ def __init__(
347347

348348
# pylint: disable=arguments-differ
349349
def run(
350-
self, version_pk, build_pk=None, commit=None, record=True, docker=None,
350+
self, version_pk, build_pk=None, commit=None, record=True,
351351
force=False, **__
352352
):
353353
"""
354354
Run a documentation sync n' build.
355355
356356
This is fully wrapped in exception handling to account for a number of
357-
failure cases. We first run a few commands in a local build environment,
357+
failure cases. We first run a few commands in a build environment,
358358
but do not report on environment success. This avoids a flicker on the
359359
build output page where the build is marked as finished in between the
360-
local environment steps and the docker build steps.
360+
local environment steps and the build steps.
361361
362362
If a failure is raised, or the build is not successful, return
363363
``False``, otherwise, ``True``.
@@ -370,17 +370,13 @@ def run(
370370
:param build_pk int: Build id (if None, commands are not recorded)
371371
:param commit: commit sha of the version required for sending build status reports
372372
:param record bool: record a build object in the database
373-
:param docker bool: use docker to build the project (if ``None``,
374-
``settings.DOCKER_ENABLE`` is used)
375373
:param force bool: force Sphinx build
376374
377375
:returns: whether build was successful or not
378376
379377
:rtype: bool
380378
"""
381379
try:
382-
if docker is None:
383-
docker = settings.DOCKER_ENABLE
384380
self.version = self.get_version(version_pk)
385381
self.project = self.version.project
386382
self.build = self.get_build(build_pk)
@@ -392,7 +388,7 @@ def run(
392388
setup_successful = self.run_setup(record=record)
393389
if not setup_successful:
394390
return False
395-
self.run_build(docker=docker, record=record)
391+
self.run_build(record=record)
396392
return True
397393
except Exception:
398394
log.exception(
@@ -437,7 +433,11 @@ def run_setup(self, record=True):
437433
438434
Return True if successful.
439435
"""
440-
self.setup_env = LocalBuildEnvironment(
436+
if settings.DOCKER_ENABLE:
437+
env_cls = DockerBuildEnvironment
438+
else:
439+
env_cls = LocalBuildEnvironment
440+
self.setup_env = env_cls(
441441
project=self.project,
442442
version=self.version,
443443
build=self.build,
@@ -508,19 +508,16 @@ def additional_vcs_operations(self):
508508
if version_repo.supports_submodules:
509509
version_repo.update_submodules(self.config)
510510

511-
def run_build(self, docker, record):
511+
def run_build(self, record):
512512
"""
513513
Build the docs in an environment.
514514
515-
:param docker: if ``True``, the build uses a ``DockerBuildEnvironment``,
516-
otherwise it uses a ``LocalBuildEnvironment`` to run all the
517-
commands to build the docs
518515
:param record: whether or not record all the commands in the ``Build``
519516
instance
520517
"""
521518
env_vars = self.get_env_vars()
522519

523-
if docker:
520+
if settings.DOCKER_ENABLE:
524521
env_cls = DockerBuildEnvironment
525522
else:
526523
env_cls = LocalBuildEnvironment

0 commit comments

Comments
 (0)