You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// ConfigureAptMirrors hardens apt against package-mirror outages on apt-based hosts.
84
+
// It bounds apt's per-request timeout and retries so an unreachable mirror fails within
85
+
// minutes instead of hanging until the CI job's 2h timeout, and on Ubuntu rewrites the apt
86
+
// sources to a "mirror+file" list so apt fails over to the global archive.ubuntu.com /
87
+
// ports.ubuntu.com mirrors when the regional EC2 mirror is down. This mirrors the pattern
88
+
// used in Dockerfiles/agent/Dockerfile. See incident 58780.
89
+
func (h*Host) ConfigureAptMirrors() {
90
+
ifh.pkgManager!="apt" {
91
+
return
92
+
}
93
+
// Fail fast when a mirror is unreachable instead of retrying with long default TCP timeouts.
94
+
h.remote.MustExecute(`printf 'Acquire::Retries "2";\nAcquire::http::Timeout "30";\nAcquire::https::Timeout "30";\n' | sudo tee /etc/apt/apt.conf.d/99datadog-e2e-fail-fast`)
95
+
// Ubuntu EC2 AMIs point at a single regional mirror with no fallback; add global mirrors.
96
+
ifh.os.Flavor!=e2eos.Ubuntu {
97
+
return
98
+
}
99
+
h.remote.MustExecute(`printf 'http://us-east-1.ec2.archive.ubuntu.com/ubuntu\tpriority:1\nhttp://archive.ubuntu.com/ubuntu\n' | sudo tee /etc/apt/mirrorlist.main`)
100
+
h.remote.MustExecute(`printf 'http://us-east-1.ec2.ports.ubuntu.com/ubuntu-ports\tpriority:1\nhttp://ports.ubuntu.com/ubuntu-ports\n' | sudo tee /etc/apt/mirrorlist.ports`)
101
+
h.remote.MustExecute(`for f in /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources; do if [ -f "$f" ]; then sudo sed -i -e 's#http://[a-z0-9.-]*ec2\.archive\.ubuntu\.com\S*#mirror+file:/etc/apt/mirrorlist.main#g' -e 's#http://archive\.ubuntu\.com\S*#mirror+file:/etc/apt/mirrorlist.main#g' -e 's#http://security\.ubuntu\.com\S*#mirror+file:/etc/apt/mirrorlist.main#g' -e 's#http://[a-z0-9.-]*ec2\.ports\.ubuntu\.com\S*#mirror+file:/etc/apt/mirrorlist.ports#g' -e 's#http://ports\.ubuntu\.com\S*#mirror+file:/etc/apt/mirrorlist.ports#g' "$f"; fi; done`)
102
+
}
103
+
83
104
// dockerImage returns the ECR pull-through URL for ecrPath when a registry is configured,
// Ubuntu EC2 hosts use a single regional mirror (e.g. us-east-1.ec2.archive.ubuntu.com).
190
-
// When it is unavailable apt has no fallback and the job hangs until the 2h timeout
191
-
// (see incident 58780). Mirror the approach used in Dockerfiles/agent/Dockerfile:
192
-
// rewrite the apt sources to a "mirror+file" list so apt fails over to the global
193
-
// archive.ubuntu.com/ports.ubuntu.com mirrors when the regional one is down.
194
-
ifs.os.Flavor!=e2eos.Ubuntu {
195
-
return
196
-
}
197
-
s.Env().RemoteHost.MustExecute(`printf 'http://us-east-1.ec2.archive.ubuntu.com/ubuntu\tpriority:1\nhttp://archive.ubuntu.com/ubuntu\n' | sudo tee /etc/apt/mirrorlist.main`)
198
-
s.Env().RemoteHost.MustExecute(`printf 'http://us-east-1.ec2.ports.ubuntu.com/ubuntu-ports\tpriority:1\nhttp://ports.ubuntu.com/ubuntu-ports\n' | sudo tee /etc/apt/mirrorlist.ports`)
199
-
s.Env().RemoteHost.MustExecute(`for f in /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources; do if [ -f "$f" ]; then sudo sed -i -e 's#http://[a-z0-9.-]*ec2\.archive\.ubuntu\.com\S*#mirror+file:/etc/apt/mirrorlist.main#g' -e 's#http://archive\.ubuntu\.com\S*#mirror+file:/etc/apt/mirrorlist.main#g' -e 's#http://security\.ubuntu\.com\S*#mirror+file:/etc/apt/mirrorlist.main#g' -e 's#http://[a-z0-9.-]*ec2\.ports\.ubuntu\.com\S*#mirror+file:/etc/apt/mirrorlist.ports#g' -e 's#http://ports\.ubuntu\.com\S*#mirror+file:/etc/apt/mirrorlist.ports#g' "$f"; fi; done`)
200
-
}
201
-
202
177
func (s*packageBaseSuite) updatePythonOnSuse() {
203
178
// Suse15 comes with Python3.6 by default which is too old for injection
0 commit comments