Skip to content

Commit e30750f

Browse files
s-zeidTheAssassin
authored andcommitted
ci: explain use of $PODMAN_USERNS in build.sh
1 parent ab25cef commit e30750f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ci/build.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ mkdir -p out/
6161
# we run all builds with non-privileged user accounts to make sure the build doesn't depend on such features
6262
uid="$(id -u)"
6363

64+
# When running under Podman (on hosts where `docker` is a shim that invokes `podman`),
65+
# UID/GID mappings may lead to permission errors when copying artifacts to `/out`.
66+
# We set the user namespace mode to `keep-id` to make sure that the host UID/GID
67+
# are mapped to the same values inside the container, but using this environment
68+
# variable (a) to not affect builds using Docker, and (b) to allow overriding the
69+
# user namespace mode easily if necessary.
70+
export PODMAN_USERNS="${PODMAN_USERNS:-keep-id}"
71+
6472
# note: we cannot just use '-e ARCH', as this wouldn't overwrite the value set via ENV ARCH=... in the image
6573
common_docker_opts=(
6674
-e TERM="$TERM"
@@ -79,7 +87,6 @@ fi
7987
# TODO: make gnupg home available, e.g., through "-v" "$HOME"/.gnupg:/root/.gnupg
8088
# TODO: this ^ won't work since we don't build as root any more
8189
# note: we enforce using the same UID in the container as outside, so that the created files are owned by the caller
82-
env PODMAN_USERNS=${PODMAN_USERNS:-keep-id} \
8390
docker run --rm \
8491
--user "$uid" \
8592
"${common_docker_opts[@]}" \

0 commit comments

Comments
 (0)