From 6b9b44e0eb64bb9467d168ff4e66e2beeddf9ad0 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Mon, 20 May 2024 09:40:41 +0200 Subject: [PATCH] Add DNS entries to hosts files on github workflows (#4776) * Refs #20652. Write hosts file on reusable-ubuntu-ci. Signed-off-by: Miguel Company * Refs #20652. Write hosts file on reusable-sanitizers-ci. Signed-off-by: Miguel Company * Refs #20652. Write hosts file on reusable-mac-ci. Signed-off-by: Miguel Company * Refs #20652. Apply review suggestions. Signed-off-by: Miguel Company --------- Signed-off-by: Miguel Company (cherry picked from commit 625b041e37f25f2a375d1200674818385540e682) --- .github/workflows/reusable-mac-ci.yml | 13 ++++++++++- .github/workflows/reusable-sanitizers-ci.yml | 24 ++++++++++++++++++++ .github/workflows/reusable-ubuntu-ci.yml | 13 ++++++++++- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable-mac-ci.yml b/.github/workflows/reusable-mac-ci.yml index fa4ece811ef..5747609fd3e 100644 --- a/.github/workflows/reusable-mac-ci.yml +++ b/.github/workflows/reusable-mac-ci.yml @@ -86,7 +86,18 @@ jobs: - name: Setup CCache uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 - # TODO(eduponz): Update known hosts file for DNS resolver testing. NOTE: The runner cannot modify /etc/hosts. + - name: Set up hosts file for DNS testing + run: | + sudo echo "" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 localhost.test" | sudo tee -a /etc/hosts + sudo echo "::1 localhost.test" | sudo tee -a /etc/hosts + sudo echo "154.56.134.194 www.eprosima.com.test" | sudo tee -a /etc/hosts + sudo echo "216.58.215.164 www.acme.com.test" | sudo tee -a /etc/hosts + sudo echo "2a00:1450:400e:803::2004 www.acme.com.test" | sudo tee -a /etc/hosts + sudo echo "140.82.121.4 www.foo.com.test" | sudo tee -a /etc/hosts + sudo echo "140.82.121.3 www.foo.com.test" | sudo tee -a /etc/hosts + sudo echo "ff1e::ffff:efff:1 acme.org.test" | sudo tee -a /etc/hosts + # TODO(eduponz): Set up libp11 and SoftHSM. NOTE: using SoftHSM requires adding the runner to a group, # which entails logout/login or rebooting the machine. This is not feasible in a CI environment. diff --git a/.github/workflows/reusable-sanitizers-ci.yml b/.github/workflows/reusable-sanitizers-ci.yml index ccd0ab96c81..633ad3ea16a 100644 --- a/.github/workflows/reusable-sanitizers-ci.yml +++ b/.github/workflows/reusable-sanitizers-ci.yml @@ -160,6 +160,18 @@ jobs: with: packages: vcstool setuptools gcovr tomark xmltodict jsondiff pandas + - name: Set up hosts file for DNS testing + run: | + sudo echo "" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 localhost.test" | sudo tee -a /etc/hosts + sudo echo "::1 localhost.test" | sudo tee -a /etc/hosts + sudo echo "154.56.134.194 www.eprosima.com.test" | sudo tee -a /etc/hosts + sudo echo "216.58.215.164 www.acme.com.test" | sudo tee -a /etc/hosts + sudo echo "2a00:1450:400e:803::2004 www.acme.com.test" | sudo tee -a /etc/hosts + sudo echo "140.82.121.4 www.foo.com.test" | sudo tee -a /etc/hosts + sudo echo "140.82.121.3 www.foo.com.test" | sudo tee -a /etc/hosts + sudo echo "ff1e::ffff:efff:1 acme.org.test" | sudo tee -a /etc/hosts + - name: Setup CCache uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 @@ -363,6 +375,18 @@ jobs: destination_workspace: src skip_existing: 'true' + - name: Set up hosts file for DNS testing + run: | + sudo echo "" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 localhost.test" | sudo tee -a /etc/hosts + sudo echo "::1 localhost.test" | sudo tee -a /etc/hosts + sudo echo "154.56.134.194 www.eprosima.com.test" | sudo tee -a /etc/hosts + sudo echo "216.58.215.164 www.acme.com.test" | sudo tee -a /etc/hosts + sudo echo "2a00:1450:400e:803::2004 www.acme.com.test" | sudo tee -a /etc/hosts + sudo echo "140.82.121.4 www.foo.com.test" | sudo tee -a /etc/hosts + sudo echo "140.82.121.3 www.foo.com.test" | sudo tee -a /etc/hosts + sudo echo "ff1e::ffff:efff:1 acme.org.test" | sudo tee -a /etc/hosts + - name: Fetch Fast DDS CI dependencies uses: eProsima/eProsima-CI/multiplatform/vcs_import@v0 with: diff --git a/.github/workflows/reusable-ubuntu-ci.yml b/.github/workflows/reusable-ubuntu-ci.yml index 1e8c56fe9e5..ec96e0ef62f 100644 --- a/.github/workflows/reusable-ubuntu-ci.yml +++ b/.github/workflows/reusable-ubuntu-ci.yml @@ -80,7 +80,18 @@ jobs: - name: Setup CCache uses: eProsima/eProsima-CI/external/setup-ccache-action@v0 - # TODO(eduponz): Update known hosts file for DNS resolver testing. NOTE: The runner cannot modify /etc/hosts. + - name: Set up hosts file for DNS testing + run: | + sudo echo "" | sudo tee -a /etc/hosts + sudo echo "127.0.0.1 localhost.test" | sudo tee -a /etc/hosts + sudo echo "::1 localhost.test" | sudo tee -a /etc/hosts + sudo echo "154.56.134.194 www.eprosima.com.test" | sudo tee -a /etc/hosts + sudo echo "216.58.215.164 www.acme.com.test" | sudo tee -a /etc/hosts + sudo echo "2a00:1450:400e:803::2004 www.acme.com.test" | sudo tee -a /etc/hosts + sudo echo "140.82.121.4 www.foo.com.test" | sudo tee -a /etc/hosts + sudo echo "140.82.121.3 www.foo.com.test" | sudo tee -a /etc/hosts + sudo echo "ff1e::ffff:efff:1 acme.org.test" | sudo tee -a /etc/hosts + # TODO(eduponz): Set up libp11 and SoftHSM. NOTE: using SoftHSM requires adding the runner to a group, # which entails logout/login or rebooting the machine. This is not feasible in a CI environment.