commit c4f85e623771ca9805f562df6d8b37623535069a
parent b2f649b1a94477322438d069526977c452a717e7
Author: Devan Carpenter <devan@taler.net>
Date: Fri, 16 Feb 2024 23:56:48 -0500
bbot: specify the user of the UID we want
If we just pull the UID value from the environment, then we get the
buildbot master user's UID, and we want to the container-worker's UID,
so we must specify this by name.
This still retains some benefits over hardcoding the UID, because at
least it can persist through system re-installations.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/buildbot/master.cfg b/buildbot/master.cfg
@@ -29,6 +29,7 @@ import configparser
import glob
import os
import pathlib
+import pwd
import re
import subprocess
@@ -230,7 +231,7 @@ def container_add_step(HALT_ON_FAILURE,
"--env", util.Interpolate("CI_GIT_BRANCH=%(src::branch)s"),
"--volume", f"{WORK_DIR}:/workdir",
"--volume", "/home/container-worker/container_artifacts:/artifacts",
- "--volume", f"/run/user/{os.getuid()}/podman/podman.sock:/run/podman/podman.sock",
+ "--volume", f"/run/user/{pwd.getpwnam('container-worker').pw_uid}/podman/podman.sock:/run/podman/podman.sock",
"--security-opt", "label=disable",
"--workdir", "/workdir",
CONTAINER_NAME, jobCmd],