From 65cdd9a05d7ebe4ef4e8c70141f5d84e1cd4cab4 Mon Sep 17 00:00:00 2001 From: Will Norris Date: Thu, 29 Jun 2023 10:09:39 -0700 Subject: [PATCH] add timeout on steps with network I/O Set a reasonable timeout to prevent jobs from hanging for hours (#50). 5 minutes is way longer than should ever be necessary, but accounts for intermittent networking issues on either the actions runner or the Tailscale package or control server. Users can always set a shorter timeout on their own action step. Fixes #50 Signed-off-by: Will Norris --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 49a3f6a..c1b5ef3 100644 --- a/action.yml +++ b/action.yml @@ -82,7 +82,7 @@ runs: if ! [[ "$SHA256SUM" ]] ; then SHA256SUM="$(curl "${URL}.sha256")" fi - curl "$URL" -o tailscale.tgz + curl "$URL" -o tailscale.tgz --max-time 300 echo "$SHA256SUM tailscale.tgz" | sha256sum -c tar -C /tmp -xzf tailscale.tgz rm tailscale.tgz @@ -113,4 +113,4 @@ runs: TAILSCALE_AUTHKEY="${{ inputs['oauth-secret'] }}?preauthorized=true&ephemeral=true" TAGS_ARG="--advertise-tags=${{ inputs.tags }}" fi - sudo -E tailscale up ${TAGS_ARG} --authkey=${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${ADDITIONAL_ARGS} + timeout 5m sudo -E tailscale up ${TAGS_ARG} --authkey=${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${ADDITIONAL_ARGS}