github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/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  # succeed 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  # Verify we can pull metadata from a few key testing images on quay.io
    29  # in the 'libpod' namespace.  This is mostly aimed at validating the
    30  # quay.io service is up and responsive.  Images were hand-picked with
    31  # egrep -ro 'quay.io/libpod/.+:latest' test | sort -u
    32  TEST_IMGS=(\
    33      alpine:latest
    34      busybox:latest
    35      alpine_labels:latest
    36      alpine_nginx:latest
    37      alpine_healthcheck:latest
    38      badhealthcheck:latest
    39      cirros:latest
    40  )
    41  
    42  echo "Checking quay.io test image accessibility"
    43  for testimg in "${TEST_IMGS[@]}"; do
    44      fqin="quay.io/libpod/$testimg"
    45      echo "    $fqin"
    46      skopeo inspect --retry-times 5 "docker://$fqin" | jq . > /dev/null
    47  done