Propagate HTTP(S)_PROXY into SSH login shells.
build-and-push / build (push) Failing after 3m12s

sshd does not forward container env; mirror kube-injected proxy vars into
/etc/environment and /etc/profile.d like DOCKER_HOST.
This commit is contained in:
Vsevolod Sauta
2026-09-21 15:48:50 +03:00
parent d6a089ec11
commit cd96d4050d
+17
View File
@@ -39,6 +39,23 @@ if [ ! -f "${HOME_DIR}/.profile" ] || ! grep -q 'DOCKER_HOST' "${HOME_DIR}/.prof
chown developer:developer "${HOME_DIR}/.profile" chown developer:developer "${HOME_DIR}/.profile"
fi fi
# sshd does not forward container env to login shells. Mirror kube-injected
# proxy vars into /etc/environment + a profile.d snippet (same path as DOCKER_HOST).
proxy_env_file=/etc/profile.d/99-kube-proxy.sh
: > "${proxy_env_file}"
chmod 644 "${proxy_env_file}"
for v in HTTP_PROXY HTTPS_PROXY http_proxy https_proxy NO_PROXY no_proxy ALL_PROXY all_proxy; do
val="${!v:-}"
[ -n "${val}" ] || continue
# Refresh /etc/environment line for this key.
if grep -q "^${v}=" /etc/environment 2>/dev/null; then
sed -i "s|^${v}=.*|${v}=${val}|" /etc/environment
else
echo "${v}=${val}" >> /etc/environment
fi
printf 'export %s=%q\n' "${v}" "${val}" >> "${proxy_env_file}"
done
# Tiny HTTP for TrinityIngress / health (Traefik terminates TLS). # Tiny HTTP for TrinityIngress / health (Traefik terminates TLS).
python3 -m http.server 8080 --bind 0.0.0.0 --directory /usr/share/devbox-http >/tmp/http-8080.log 2>&1 & python3 -m http.server 8080 --bind 0.0.0.0 --directory /usr/share/devbox-http >/tmp/http-8080.log 2>&1 &