Skip to content

Commit

Permalink
Wait for autograph heartbeat before starting lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
oskirby committed Jun 21, 2024
1 parent fd021d1 commit a7f1f7d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tools/autograph-monitor/lambda-setup-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
set -e
set -o pipefail

# Wait for the heartbeat
HEARTBEAT=$(curl --silent \
--connect-timeout 5 \
--max-time 10 \
--retry-connrefused \
--retry 5 \
--retry-delay 5 \
--retry-max-time 60 \
"${AUTOGRAPH_URL}/__heartbeat__")
RETCODE=$?
if [ $RETCODE -ne 0 ]; then
echo "Failed to reach autograph heartbeat" >&2
exit $RETCODE
fi

# Fetch the normandy root hash
export AUTOGRAPH_ROOT_HASH=$(autograph-client -t "$AUTOGRAPH_URL" -listconfig normandy | \
jq -r '.cacert' | openssl x509 -outform der | openssl dgst -sha256 -hex | \
Expand Down

0 comments on commit a7f1f7d

Please sign in to comment.