You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2021/11/25 07:20:47 UTC

[apisix] branch master updated: ci(bug): Improve DNS settings (#5601)

This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 783b387  ci(bug): Improve DNS settings (#5601)
783b387 is described below

commit 783b387f8167a52d5df8fa02c46d72fcab9b506c
Author: Zeping Bai <bz...@apache.org>
AuthorDate: Thu Nov 25 15:20:43 2021 +0800

    ci(bug): Improve DNS settings (#5601)
    
    CentOS docker: use `--dns` parameter
    Ubuntu: use `netplan`
---
 .github/workflows/centos7-ci.yml |  2 +-
 utils/set-dns.sh                 | 20 ++++++++++++++++++--
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/centos7-ci.yml b/.github/workflows/centos7-ci.yml
index 5f9f6ec..db5ad0b 100644
--- a/.github/workflows/centos7-ci.yml
+++ b/.github/workflows/centos7-ci.yml
@@ -57,7 +57,7 @@ jobs:
 
     - name: Run centos7 docker and mapping apisix into container
       run: |
-        docker run -itd -v /home/runner/work/apisix/apisix:/apisix --name centos7Instance --net="host" docker.io/centos:7 /bin/bash
+        docker run -itd -v /home/runner/work/apisix/apisix:/apisix --name centos7Instance --net="host" --dns 8.8.8.8 --dns-search apache.org docker.io/centos:7 /bin/bash
         # docker exec centos7Instance bash -c "cp -r /tmp/apisix ./"
 
     - name: Run other docker containers for test
diff --git a/utils/set-dns.sh b/utils/set-dns.sh
index 53970a7..2c7689d 100755
--- a/utils/set-dns.sh
+++ b/utils/set-dns.sh
@@ -25,8 +25,24 @@ echo "127.0.0.1 test.com" | sudo tee -a /etc/hosts
 echo "127.0.0.1 admin.apisix.dev" | sudo tee -a /etc/hosts
 cat /etc/hosts # check GitHub Action's configuration
 
-echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
-echo "search apache.org" | sudo tee -a /etc/resolv.conf
+# override DNS configures
+if [ -f "/etc/netplan/50-cloud-init.yaml" ]; then
+    sudo pip3 install yq
+
+    tmp=$(mktemp)
+    yq -y '.network.ethernets.eth0."dhcp4-overrides"."use-dns"=false' /etc/netplan/50-cloud-init.yaml | \
+    yq -y '.network.ethernets.eth0."dhcp4-overrides"."use-domains"=false' | \
+    yq -y '.network.ethernets.eth0.nameservers.addresses[0]="8.8.8.8"' | \
+    yq -y '.network.ethernets.eth0.nameservers.search[0]="apache.org"' > $tmp
+    mv $tmp /etc/netplan/50-cloud-init.yaml
+    cat /etc/netplan/50-cloud-init.yaml
+    sudo netplan apply
+    sleep 3
+
+    sudo mv /etc/resolv.conf /etc/resolv.conf.bak
+    sudo ln -s /run/systemd/resolve/resolv.conf /etc/
+fi
+cat /etc/resolv.conf
 
 mkdir -p build-cache