Skip to content

Commit

Permalink
Add check for IPv6.
Browse files Browse the repository at this point in the history
  • Loading branch information
danfuzz committed May 31, 2023
1 parent 7f37434 commit 1f2b62b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/lib/milky-cloud/instance/wait-until-responsive
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ process-args "$@" || usage --short
# Helper functions
#

# Does the machine running this script seem to have IPv6? This cursed function
# is needed because, as of this writing, GitHub Actions does not run user code
# on machines that have IPv6. Blurgh!
#
# See <https://github.com/actions/runner-images/issues/668>.
function is-ipv6-available {
# `-c 1` == one packet
ping6 >/dev/null 2>&1 -c 1 google.com
}

# Waits for just one instance to be in state `running`.
function wait-for-one-running {
local infoJson="$1"
Expand Down Expand Up @@ -154,6 +164,10 @@ function wait-for-one-ssh {
# Don't bother re-checking the key; just care if we got one.
if [[ ${gotKey} == '' ]]; then
"${msg}" 'ssh unreachable via IPv6'
if ! is-ipv6-available; then
"${msg}" '(but IPv6 is not available at all here)'
return
fi
return 1
fi

Expand Down

0 comments on commit 1f2b62b

Please sign in to comment.