Skip to content

Commit 72ed4c3

Browse files
Copilotphlax
andcommitted
Revert all DNS configuration changes
Revert all changes to docker/linux/ubuntu/fun.sh as requested. The approach was incorrect - DNS configuration needs to be in an entrypoint, not in install functions. Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
1 parent c403f12 commit 72ed4c3

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

docker/linux/ubuntu/fun.sh

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -112,50 +112,7 @@ ensure_stdlibcc () {
112112
apt list libstdc++6 | grep installed | grep "$LIBSTDCXX_EXPECTED_VERSION"
113113
}
114114

115-
configure_dns_fast_fail () {
116-
# Configure DNS to fail fast for non-existent domains
117-
# This mitigates systemd-resolved timeout issues in recent Ubuntu updates
118-
# where DNS queries for non-existent domains timeout instead of failing immediately
119-
120-
# In Docker containers, we need to configure /etc/resolv.conf with fast-fail options
121-
# The options timeout:N and attempts:N control DNS resolution behavior:
122-
# - timeout: seconds to wait for a response before trying next server (default 5)
123-
# - attempts: number of times to try each nameserver (default 2)
124-
#
125-
# NOTE: timeout:1 attempts:1 is aggressive but necessary for tests that expect
126-
# immediate failure for non-existent domains. This prevents CI timeouts.
127-
128-
# Check if /etc/resolv.conf exists and is writable
129-
if [ -f /etc/resolv.conf ]; then
130-
# Remove the file if it's a symlink to allow us to create a real file
131-
if [ -L /etc/resolv.conf ]; then
132-
# Preserve the current content before removing the symlink
133-
local temp_resolv
134-
temp_resolv=$(mktemp -m 600)
135-
cat /etc/resolv.conf > "$temp_resolv" 2>/dev/null || true
136-
rm -f /etc/resolv.conf
137-
cat "$temp_resolv" > /etc/resolv.conf
138-
rm -f "$temp_resolv"
139-
fi
140-
141-
# Add DNS timeout options if not already present
142-
if ! grep -q "^options" /etc/resolv.conf 2>/dev/null; then
143-
# Insert options line at the beginning for faster DNS failure
144-
sed -i '1i options timeout:1 attempts:1' /etc/resolv.conf
145-
else
146-
# Options line exists, check if we need to add timeout or attempts
147-
if ! grep -q "^options.*timeout" /etc/resolv.conf 2>/dev/null; then
148-
sed -i '/^options/ s/$/ timeout:1/' /etc/resolv.conf
149-
fi
150-
if ! grep -q "^options.*attempts" /etc/resolv.conf 2>/dev/null; then
151-
sed -i '/^options/ s/$/ attempts:1/' /etc/resolv.conf
152-
fi
153-
fi
154-
fi
155-
}
156-
157115
install_base () {
158-
configure_dns_fast_fail
159116
apt_install "${COMMON_PACKAGES[@]}"
160117
add_ubuntu_keys "${APT_KEYS_ENV[@]}"
161118
add_apt_repos "${APT_REPOS_ENV[@]}"
@@ -193,14 +150,12 @@ mobile_install_jdk () {
193150
}
194151

195152
mobile_install () {
196-
configure_dns_fast_fail
197153
add_ubuntu_keys "${APT_KEYS_MOBILE[@]}"
198154
mobile_install_jdk
199155
mobile_install_android
200156
}
201157

202158
install () {
203-
configure_dns_fast_fail
204159
add_apt_key "${APT_KEY_DOCKER}"
205160
add_apt_k8s_key "${APT_KEY_K8S}"
206161
add_apt_repos "${APT_REPOS[@]}"
@@ -215,14 +170,12 @@ install () {
215170
}
216171

217172
install_ci () {
218-
configure_dns_fast_fail
219173
ensure_stdlibcc
220174
apt-get -qq update -y
221175
apt-get -qq install -y --no-install-recommends "${CI_PACKAGES[@]}"
222176
install_build
223177
}
224178

225179
install_llvm () {
226-
configure_dns_fast_fail
227180
install_llvm_bins
228181
}

0 commit comments

Comments
 (0)