Release: resolve containerized runner workspace
Container CI / release-build (push) Failing after 25s

Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-07-26 02:38:31 +03:00
1 parent c08ff6ca68
commit 5547621cfa
2 files changed
+76 -4

No files matched your search

+71 -3
View File
@@ -205,10 +205,68 @@ container_path() {
esac
}
docker_daemon_path() {
local path=$1
local container_reference=${ECHOION_DOCKER_CONTAINER_ID:-}
local mount_data=
local mount_source mount_destination
local best_source='' best_destination=''
if [[ -z $container_reference ]]; then
container_reference=${JOB_CONTAINER_NAME:-${HOSTNAME:-}}
fi
# A containerized CI job talks to the host Docker daemon through its
# socket. Bind-mount source paths are therefore interpreted in the daemon
# host namespace, not in this job container. Resolve the longest matching
# mount from the current container so nested release containers see the
# checked-out workspace instead of an empty host directory.
if [[ -n ${ECHOION_DOCKER_CONTAINER_ID:-} ||
-f /.dockerenv || -f /run/.containerenv ]]; then
if [[ -n $container_reference ]]; then
mount_data=$(
docker inspect \
--format '{{range .Mounts}}{{printf "%s\t%s\n" .Source .Destination}}{{end}}' \
"$container_reference" 2>/dev/null || true
)
fi
fi
while IFS=$'\t' read -r mount_source mount_destination; do
[[ -n $mount_source && -n $mount_destination ]] || continue
case $path in
"$mount_destination"|"$mount_destination"/*)
if ((${#mount_destination} > ${#best_destination})); then
best_source=$mount_source
best_destination=$mount_destination
fi
;;
*)
if [[ $mount_destination == / && $path == /* ]]; then
best_source=$mount_source
best_destination=$mount_destination
fi
;;
esac
done <<<"$mount_data"
if [[ -z $best_destination ]]; then
printf '%s\n' "$path"
elif [[ $path == "$best_destination" ]]; then
printf '%s\n' "$best_source"
elif [[ $best_destination == / ]]; then
printf '%s/%s\n' "${best_source%/}" "${path#/}"
else
printf '%s/%s\n' \
"${best_source%/}" "${path#"$best_destination"/}"
fi
}
if ((use_container)); then
command -v docker >/dev/null || die "docker is required for --container"
container_build_dir=$(container_path "$build_dir")
container_dist_dir=$(container_path "$dist_dir")
docker_source_dir=$(docker_daemon_path "$source_dir")
image="echoion-release-builder:gcc-16.1.0"
proxy_build_args=()
proxy_run_args=()
@@ -229,20 +287,22 @@ if ((use_container)); then
container_args=(
--rm
--user "$(id -u):$(id -g)"
--volume "$source_dir:/workspace"
--volume "$docker_source_dir:/workspace"
--workdir /workspace
--env HOME=/tmp/echoion-release-home
--env npm_config_cache=/tmp/echoion-npm-cache
)
container_args+=("${proxy_run_args[@]}")
if [[ -n $void_source ]]; then
docker_void_source=$(docker_daemon_path "$void_source")
container_args+=(
--volume "$void_source:/workspace-deps/VoidLibrary:ro"
--volume "$docker_void_source:/workspace-deps/VoidLibrary:ro"
)
fi
if [[ -n $void_teamspeak_source ]]; then
docker_void_teamspeak_source=$(docker_daemon_path "$void_teamspeak_source")
container_args+=(
--volume "$void_teamspeak_source:/workspace-deps/VoidTeamspeak:ro"
--volume "$docker_void_teamspeak_source:/workspace-deps/VoidTeamspeak:ro"
)
fi
if [[ -n ${SOURCE_DATE_EPOCH:-} ]]; then
@@ -275,6 +335,14 @@ if ((use_container)); then
release_args+=(
--official-update-feed-url "$official_update_feed_url"
)
if [[ $docker_source_dir != "$source_dir" ]]; then
echo "release: mapped container workspace through the Docker daemon mount table"
fi
docker run --rm --platform linux/amd64 \
--volume "$docker_source_dir:/workspace:ro" \
"$image" \
test -x /workspace/scripts/release.sh ||
die "Docker daemon cannot access the checked-out source tree"
docker run --platform linux/amd64 "${container_args[@]}" "$image" \
bash scripts/release.sh "${release_args[@]}"
exit