github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/contrib/cirrus/ext_svc_check.sh (about)

     1  #!/bin/bash
     2  
     3  set -eo pipefail
     4  
     5  # This script attempts basic confirmation of functional networking
     6  # by connecting to a set of essential external servers and failing
     7  # if any cannot be reached.  It's intended for use early on in the
     8  # podman CI system, to help prevent wasting time on tests that can't
     9  # succeede due to some outage or another.
    10  
    11  # shellcheck source=./contrib/cirrus/lib.sh
    12  source $(dirname $0)/lib.sh
    13  
    14  cat ${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/required_host_ports.txt | \
    15      while read host port
    16      do
    17          if [[ "$port" -eq "443" ]]
    18          then
    19              echo "SSL/TLS to $host:$port"
    20              echo -n '' | \
    21                  err_retry 9 1000 "" openssl s_client -quiet -no_ign_eof -connect $host:$port
    22          else
    23              echo "Connect to $host:$port"
    24              err_retry 9 1000 1 nc -zv -w 13 $host $port
    25          fi
    26      done
    27  
    28  # TODO: Pull images required during testing into /dev/null
    29  
    30  # TODO: Refresh DNF package-cache into /dev/null