Browse Source

[CI] Forward port Amazon Linux 2 dns fix from #107907 (#113902) (#114062)

(cherry picked from commit 4a7a5b7b3c1ad3426ffe96083212d68da88c4e1c)
Brian Seeders 1 year ago
parent
commit
b9fa53092c
1 changed files with 8 additions and 0 deletions
  1. 8 0
      .buildkite/hooks/pre-command

+ 8 - 0
.buildkite/hooks/pre-command

@@ -109,3 +109,11 @@ EOF
 <summary>Agent information from gobld</summary>
 EOF
 fi
+
+# Amazon Linux 2 has DNS resolution issues with resource-based hostnames in EC2
+# We have many functional tests that try to lookup and resolve the hostname of the local machine in a particular way
+# And they fail. This sets up a manual entry for the hostname in dnsmasq.
+if [[ -f /etc/os-release ]] && grep -q '"Amazon Linux 2"' /etc/os-release; then
+  echo "$(hostname -i | cut -d' ' -f 2)  $(hostname -f)." | sudo tee /etc/dnsmasq.hosts
+  sudo systemctl restart dnsmasq.service
+fi