Merge bitcoin/bitcoin#27376: ci: Remove second user account

fafe3a8e38 ci: Remove second user account (MarcoFalke)

Pull request description:

  The rationale for the second (nonroot) account no longer applies. See also https://github.com/bitcoin/bitcoin/pull/27333#discussion_r1148898438

ACKs for top commit:
  josibake:
    utACK fafe3a8e38

Tree-SHA512: 4464e50bc6499e012ff33c591f20c5989b99e223c476cefea669aedb79a0e731734db9469d4c7d800642191b43b57ea32cda187093395f100dec719fea17724d
This commit is contained in:
fanquake 2023-03-31 13:14:28 +01:00
commit 5c2bb2b54c
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
2 changed files with 3 additions and 22 deletions

View file

@ -28,11 +28,6 @@ export BINS_SCRATCH_DIR="${BASE_SCRATCH_DIR}/bins/"
if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
echo "Creating $CI_IMAGE_NAME_TAG container to run in"
LOCAL_UID=$(id -u)
LOCAL_GID=$(id -g)
# the name isn't important, so long as we use the same UID
LOCAL_USER=nonroot
DOCKER_BUILDKIT=1 ${CI_RETRY_EXE} docker build \
--file "${BASE_ROOT_DIR}/ci/test_imagefile" \
--build-arg "CI_IMAGE_NAME_TAG=${CI_IMAGE_NAME_TAG}" \
@ -59,18 +54,9 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
--name $CONTAINER_NAME \
$CONTAINER_NAME)
export CI_CONTAINER_ID
export CI_EXEC_CMD_PREFIX_ROOT="docker exec -u 0 $CI_CONTAINER_ID"
export CI_EXEC_CMD_PREFIX="docker exec -u $LOCAL_UID $CI_CONTAINER_ID"
$CI_EXEC_CMD_PREFIX_ROOT rsync --archive --stats --human-readable /ci_base_install/ "${BASE_ROOT_DIR}"
$CI_EXEC_CMD_PREFIX_ROOT rsync --archive --stats --human-readable /ro_base/ "$BASE_ROOT_DIR"
# Create a non-root user inside the container which matches the local user.
#
# This prevents the root user in the container modifying the local file system permissions
# on the mounted directories
docker exec "$CI_CONTAINER_ID" useradd -u "$LOCAL_UID" -o -m "$LOCAL_USER"
docker exec "$CI_CONTAINER_ID" groupmod -o -g "$LOCAL_GID" "$LOCAL_USER"
docker exec "$CI_CONTAINER_ID" chown -R "$LOCAL_USER":"$LOCAL_USER" "${BASE_ROOT_DIR}"
export CI_EXEC_CMD_PREFIX="docker exec ${CI_CONTAINER_ID}"
$CI_EXEC_CMD_PREFIX rsync --archive --stats --human-readable /ci_base_install/ "${BASE_ROOT_DIR}"
$CI_EXEC_CMD_PREFIX rsync --archive --stats --human-readable /ro_base/ "$BASE_ROOT_DIR"
else
echo "Running on host system without docker wrapper"
"${BASE_ROOT_DIR}/ci/test/01_base_install.sh"
@ -79,11 +65,7 @@ fi
CI_EXEC () {
$CI_EXEC_CMD_PREFIX bash -c "export PATH=${BINS_SCRATCH_DIR}:\$PATH && cd \"$P_CI_DIR\" && $*"
}
CI_EXEC_ROOT () {
$CI_EXEC_CMD_PREFIX_ROOT bash -c "export PATH=${BINS_SCRATCH_DIR}:\$PATH && cd \"$P_CI_DIR\" && $*"
}
export -f CI_EXEC
export -f CI_EXEC_ROOT
CI_EXEC mkdir -p "${BINS_SCRATCH_DIR}"

View file

@ -11,7 +11,6 @@ if [ "$CI_OS_NAME" == "macos" ]; then
echo > "${HOME}/Library/Application Support/Bitcoin"
else
CI_EXEC echo \> \$HOME/.bitcoin
CI_EXEC_ROOT echo \> \$HOME/.bitcoin
fi
if [ -z "$NO_DEPENDS" ]; then