6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-13 14:43:03 +00:00

fix: mounts were not being rendered in dev mode

Commit 514e3fce22 made it so
that dev containers were to load mounts from
env/dev/docker-compose.tmp.yml. However, it did not update
the code to generates the docker-compose.tmp.yml files.
This manifested as mounts simply not working in dev mode.

Additionally, we make the docker-compose.jobs.tmp.yml files
follow the same local vs dev differentiation that
was introduced in 514e3fce22.
This commit is contained in:
Kyle McCormick 2022-05-06 16:36:26 -04:00 committed by Régis Behmo
parent 4b587e41d4
commit 931d46e6b0
4 changed files with 13 additions and 6 deletions

View File

@ -20,6 +20,7 @@ class ComposeJobRunner(jobs.BaseComposeJobRunner):
self.docker_compose_files: t.List[str] = []
self.docker_compose_job_files: t.List[str] = []
self.docker_compose_tmp_path = ""
self.docker_compose_jobs_tmp_path = ""
def docker_compose(self, *command: str) -> int:
"""
@ -62,11 +63,11 @@ class ComposeJobRunner(jobs.BaseComposeJobRunner):
)
tutor_env.write_to(
serialize.dumps(docker_compose_tmp),
tutor_env.pathjoin(self.root, "local", "docker-compose.tmp.yml"),
self.docker_compose_tmp_path,
)
tutor_env.write_to(
serialize.dumps(docker_compose_jobs_tmp),
tutor_env.pathjoin(self.root, "local", "docker-compose.jobs.tmp.yml"),
self.docker_compose_jobs_tmp_path,
)
def run_job(self, service: str, command: str) -> int:

View File

@ -21,6 +21,9 @@ class DevJobRunner(compose.ComposeJobRunner):
self.docker_compose_tmp_path = tutor_env.pathjoin(
self.root, "dev", "docker-compose.tmp.yml"
)
self.docker_compose_jobs_tmp_path = tutor_env.pathjoin(
self.root, "dev", "docker-compose.jobs.tmp.yml"
)
self.docker_compose_files += [
tutor_env.pathjoin(self.root, "local", "docker-compose.yml"),
tutor_env.pathjoin(self.root, "dev", "docker-compose.yml"),
@ -31,7 +34,7 @@ class DevJobRunner(compose.ComposeJobRunner):
self.docker_compose_job_files += [
tutor_env.pathjoin(self.root, "local", "docker-compose.jobs.yml"),
tutor_env.pathjoin(self.root, "dev", "docker-compose.jobs.yml"),
tutor_env.pathjoin(self.root, "local", "docker-compose.jobs.tmp.yml"),
self.docker_compose_jobs_tmp_path,
tutor_env.pathjoin(self.root, "local", "docker-compose.jobs.override.yml"),
tutor_env.pathjoin(self.root, "dev", "docker-compose.jobs.override.yml"),
]

View File

@ -21,7 +21,10 @@ class LocalJobRunner(compose.ComposeJobRunner):
super().__init__(root, config)
self.project_name = get_typed(self.config, "LOCAL_PROJECT_NAME", str)
self.docker_compose_tmp_path = tutor_env.pathjoin(
self.root, "dev", "docker-compose.tmp.yml"
self.root, "local", "docker-compose.tmp.yml"
)
self.docker_compose_jobs_tmp_path = tutor_env.pathjoin(
self.root, "local", "docker-compose.jobs.tmp.yml"
)
self.docker_compose_files += [
tutor_env.pathjoin(self.root, "local", "docker-compose.yml"),
@ -31,7 +34,7 @@ class LocalJobRunner(compose.ComposeJobRunner):
]
self.docker_compose_job_files += [
tutor_env.pathjoin(self.root, "local", "docker-compose.jobs.yml"),
tutor_env.pathjoin(self.root, "local", "docker-compose.jobs.tmp.yml"),
self.docker_compose_jobs_tmp_path,
tutor_env.pathjoin(self.root, "local", "docker-compose.jobs.override.yml"),
]

View File

@ -142,7 +142,7 @@ class Filters:
#: conditionnally add mounts.
COMPOSE_MOUNTS = filters.get("compose:mounts")
#: Contents of the local/docker-compose.tmp.yml file that will be generated at
#: Contents of the (local|dev)/docker-compose.tmp.yml files that will be generated at
#: runtime. This is used for instance to bind-mount folders from the host (see
#: :py:data:`COMPOSE_MOUNTS`)
#: