From e5008494eced29873f023f2f04478dd85f103de9 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 13 Jun 2019 10:21:30 -0700 Subject: [PATCH] Change default job_dir location To increase the chances that job_dir and git_dir are on the same filesystem in the default configuration, set the default job_dir to /var/lib/zuul/builds. Also, all zuul container images specify a volume at /var/lib/zuul, therefore the docker-compose file does not need to specify the same for the scheduler container. Due to this, we were inadvertently running the executor with the git_dir and job_dir on different filesystems in the quick-start. That should no longer be the case. Change-Id: I2fe5eea588006da7181c3ea8ad2637598764e8f1 --- doc/source/admin/components.rst | 2 +- doc/source/admin/examples/docker-compose.yaml | 1 - .../notes/jobdir_default-991bd60141045b68.yaml | 13 +++++++++++++ zuul/cmd/executor.py | 5 +++-- 4 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/jobdir_default-991bd60141045b68.yaml diff --git a/doc/source/admin/components.rst b/doc/source/admin/components.rst index e2c197ce62..97f17f93fc 100644 --- a/doc/source/admin/components.rst +++ b/doc/source/admin/components.rst @@ -529,7 +529,7 @@ The following sections of ``zuul.conf`` are used by the executor: cache. .. attr:: job_dir - :default: /tmp + :default: /var/lib/zuul/builds Directory that Zuul should use to hold temporary job directories. When each job is run, a new entry will be created under this diff --git a/doc/source/admin/examples/docker-compose.yaml b/doc/source/admin/examples/docker-compose.yaml index 20c9d36226..99df901630 100644 --- a/doc/source/admin/examples/docker-compose.yaml +++ b/doc/source/admin/examples/docker-compose.yaml @@ -54,7 +54,6 @@ services: - "./etc_zuul/:/etc/zuul/:z" - "./playbooks/:/var/playbooks/:z" - "sshkey:/var/ssh:z" - - /var/lib/zuul web: command: "sh -c '/var/playbooks/wait-to-start-gearman.sh && zuul-web -d'" depends_on: diff --git a/releasenotes/notes/jobdir_default-991bd60141045b68.yaml b/releasenotes/notes/jobdir_default-991bd60141045b68.yaml new file mode 100644 index 0000000000..ddb31d1c80 --- /dev/null +++ b/releasenotes/notes/jobdir_default-991bd60141045b68.yaml @@ -0,0 +1,13 @@ +--- +upgrade: + - | + The default value for the :attr:`executor.job_dir` configuration + setting has been changed from ``/tmp`` to + ``/var/lib/zuul/builds``. It is important for + :attr:`executor.job_dir` and :attr:`executor.git_dir` to be + located on the same filesystem, so this change increases the chances + that they end up on the same filesystem in most default configurations. + + The ``builds`` subdirectory will be created if it does not exist, + however, ``/var/lib/zuul`` at least must exist and be writable by + the Zuul user. diff --git a/zuul/cmd/executor.py b/zuul/cmd/executor.py index ba7426315d..ceb422eb4a 100755 --- a/zuul/cmd/executor.py +++ b/zuul/cmd/executor.py @@ -18,7 +18,6 @@ import logging import os import sys import signal -import tempfile import zuul.cmd import zuul.executor.server @@ -86,7 +85,9 @@ class Executor(zuul.cmd.ZuulDaemonApp): job_dir=self.job_dir)) sys.exit(1) else: - self.job_dir = tempfile.mkdtemp() + self.job_dir = '/var/lib/zuul/builds' + if not os.path.exists(self.job_dir): + os.mkdir(self.job_dir) self.setup_logging('executor', 'log_config') self.log = logging.getLogger("zuul.Executor")