From 250b04eef3496b8eb28a1b5827066d2051631af9 Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Tue, 24 Nov 2026 08:44:03 +0000 Subject: [PATCH] fix(molecule): give the runner user a passwd entry in the ci container ansible makes its temp dir under ~/.ansible/tmp. Without a passwd entry the tilde does not expand and mkdir runs relative to the playbook's directory, which is read-only under /opt/venv once the image's own molecule is used. Move molecule.yml to ci 0.2.40 so this pull request runs the baked toolchain that failed on the pin pull request. Assisted-by: Claude Code --- .gitea/workflows/molecule.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/molecule.yml b/.gitea/workflows/molecule.yml index e2395d7..a403263 100644 --- a/.gitea/workflows/molecule.yml +++ b/.gitea/workflows/molecule.yml @@ -67,7 +67,7 @@ jobs: env: # The tools and collections molecule runs with: the image Lint and Build use. CI_IMAGE: >- - git.rkdr.net/mortis/ci:0.2.39@sha256:61c25c2c6ad83361e596175bd4fa76141c6a910d27bbb7fc6692f752fdbd29ef + git.rkdr.net/mortis/ci:0.2.40@sha256:fcb063b570cc8e379fa0e3cc0409ceee4e5b7f848f97cd1663c0b9f7a7da221c # Used by the scenarios as `image: ${MOLECULE_IMAGE}`; set it the same way to run # one locally. MOLECULE_IMAGE: >- @@ -133,19 +133,21 @@ jobs: fi selected="$(python3 -I "$sel" "$BASE_REF")" || exit 1 - # As the runner user, with the socket's group, so nothing in the job tree is left - # root-owned; HOME (ansible's temp and caches) is in the job tree too. The user has no - # passwd entry in the image, so USER names it. The driver's connection plugin + # As the runner user, with the socket's group, so nothing in the job tree is left root-owned. + # HOME (ansible's temp and caches) is in the job tree; a mounted passwd entry points the user + # at it, because ansible's temp path is `~/.ansible/tmp`. The driver's connection plugin # (community.docker.docker) runs the docker CLI, which the image lacks: the host's goes in. ac_root="$(cd ../../.. && pwd)" sock_gid="$(stat -c %g /var/run/docker.sock)" docker_cli="$(readlink -f "$(command -v docker)")" mkdir -p "$ac_root/home" + printf 'root:x:0:0:root:/root:/bin/bash\n%s:x:%s:%s::%s:/bin/bash\n' \ + "$(id -un)" "$(id -u)" "$(id -g)" "$ac_root/home" > "$ac_root/passwd" docker run --rm -i --init --name "$RUN_CONTAINER" \ --label "net.rkdr.mortis.molecule-run=$RUN_CONTAINER" \ --user "$(id -u):$(id -g)" --group-add "$sock_gid" \ -v /var/run/docker.sock:/var/run/docker.sock -v "$docker_cli:/usr/local/bin/docker:ro" \ - -v "$ac_root:$ac_root" -w "$PWD" \ + -v "$ac_root:$ac_root" -v "$ac_root/passwd:/etc/passwd:ro" -w "$PWD" \ -e "AC_ROOT=$ac_root" -e "HOME=$ac_root/home" -e "USER=$(id -un)" \ -e MOLECULE_IMAGE -e MOLECULE_IMAGE_2604 \ "$CI_IMAGE" scripts/run_molecule_in_ci_image.sh <<< "$selected" -- 2.43.0