launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25282
[Merge] ~twom/lpbuildbot-worker:fix-id-map-at-build into lpbuildbot-worker:main
Tom Wardill has proposed merging ~twom/lpbuildbot-worker:fix-id-map-at-build into lpbuildbot-worker:main.
Commit message:
Fix idmap at build stage
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~twom/lpbuildbot-worker/+git/lpbuildbot-worker/+merge/390694
Hardcoded idmaps for the host machine are bad, lets use the fix that we already have elsewhere.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/lpbuildbot-worker:fix-id-map-at-build into lpbuildbot-worker:main.
diff --git a/lp-setup-lxd-build b/lp-setup-lxd-build
index 8d48d17..ba2d386 100755
--- a/lp-setup-lxd-build
+++ b/lp-setup-lxd-build
@@ -4,6 +4,7 @@ import argparse
import os
from os.path import expanduser
import pathlib
+from pwd import getpwnam
import shlex
import subprocess
import sys
@@ -45,7 +46,11 @@ def start_new_container(client, image_name, work_dir):
"profiles": ["default"],
"type": "container",
"source": {"type": "image", "alias": image_name},
- "config": {"raw.idmap": "uid 112 1001\ngid 116 1001"},
+ "config": {
+ "raw.idmap": "uid {} 1001\ngid {} 1001".format(
+ getpwnam("buildbot").pw_uid, getpwnam("buildbot").pw_gid
+ )
+ },
"devices": {"build": {"path": work_dir, "source": work_dir, "type": "disk"}},
}
container = client.containers.create(image_data, wait=True)