From e50405e5a39fcd3007791a9c02c0a013781584b4 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 18 Feb 2022 15:02:22 -0800 Subject: [PATCH] hack/build-rpms.sh: fix yum-builddep failures This tries to solve a failure in building rpms, and consists of two fixes. 1. Looking into cri-o CI, this error seems common: http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 2600:1f16:c1:5e03:a992:8ee1:99d2:6f8: Network is unreachable" http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: [Errno 14] curl#7 - "Failed to connect to 2600:1f16:c1:5e03:a992:8ee1:99d2:6f8: Network is unreachable" http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: [Errno 14] HTTPS Error 301 - Moved Permanently [ERROR] hack/build-rpms.sh:31: `yum-builddep -y "${OS_RPM_SPECFILE}"` exited with status 1. Apparently, vault.centos.org resolves to both IPv4 and IPv6 addresses, and one of the addresses is used (randomly, I presume). If the node does not have IPv6 connectivity (as it seems to be the case), as a result we have 50% chance of failure. Work around this by asking yum to only use IPv4 for address resolving. 2. vault.centos.org is super slow, resulting in numerous timeouts, often fatal: http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: [Errno 12] Timeout on http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds') http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: [Errno 12] Timeout on http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds') http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: [Errno 12] Timeout on http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds') http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: [Errno 12] Timeout on http://vault.centos.org/centos/7/os/Source/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds') [ERROR] hack/build-rpms.sh:38: `yum-builddep -y "${OS_RPM_SPECFILE}"` exited with status 1. Let's use mirrors.kernel.org instead. Signed-off-by: Kir Kolyshkin --- hack/build-rpms.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hack/build-rpms.sh b/hack/build-rpms.sh index 9195282dee6..58cf9c73db3 100755 --- a/hack/build-rpms.sh +++ b/hack/build-rpms.sh @@ -28,6 +28,17 @@ tar czf "${rpm_tmp_dir}/SOURCES/${OS_RPM_NAME}-test.tar.gz" \ . cp -r "${ci_data}/." "${rpm_tmp_dir}/SOURCES" +# Some CI environments do not have IPv6 connectivity, while vault.centos.org +# resolves to both IPv4 and IPv6 addresses. This result in occasional +# "Network is unreachable" errors. Workaround: disable IPv6 for yum. +if [ -w /etc/yum.conf ] && ! grep -q '^ip_resolve' /etc/yum.conf; then + os::log::info "Disabling IPv6 for yum ..." + echo 'ip_resolve=4' >> /etc/yum.conf +fi +# The default configuration for source repos is to use vault.centos.org +# (no mirrors provided), which is super slow as of late, resulting in +# timeouts. Workaround: use mirrors.kernel.org instead. +sed -i 's|//vault.centos.org/centos/|//archive.kernel.org/centos-vault/centos/|g' /etc/yum.repos.d/CentOS-Sources.repo yum-builddep -y "${OS_RPM_SPECFILE}" rpmbuild -ba "${OS_RPM_SPECFILE}" \