docs(operations): record v1 readiness evidence (#23)
This commit is contained in:
@@ -19,6 +19,7 @@ COORDINATION_FILE="${RENDEZVOUS_CANARY_COORDINATION_FILE:-}"
|
||||
LISTING_ID="${RENDEZVOUS_CANARY_LISTING_ID:-}"
|
||||
REQUIRE_CLEAN="${RENDEZVOUS_CANARY_REQUIRE_CLEAN:-true}"
|
||||
KEEP_RAW="${RENDEZVOUS_CANARY_KEEP_RAW:-false}"
|
||||
UUID_PATTERN='^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'
|
||||
|
||||
usage() {
|
||||
printf '%s\n' \
|
||||
@@ -28,7 +29,7 @@ usage() {
|
||||
exit 2
|
||||
}
|
||||
|
||||
for command in date dotnet git jq mktemp; do
|
||||
for command in date dotnet git jq mktemp tail; do
|
||||
command -v "$command" >/dev/null || {
|
||||
printf 'Missing required command: %s\n' "$command" >&2
|
||||
exit 2
|
||||
@@ -98,12 +99,16 @@ if [[ "$ROLE" == host ]]; then
|
||||
printf 'The host role requires RENDEZVOUS_CANARY_COORDINATION_FILE.\n' >&2
|
||||
exit 2
|
||||
fi
|
||||
if [[ -e "$COORDINATION_FILE" ]]; then
|
||||
printf 'The host coordination file already exists; remove it explicitly before a new canary.\n' >&2
|
||||
exit 2
|
||||
fi
|
||||
if [[ -z "${RENDEZVOUS_PUBLISHER_CREDENTIAL:-}" ]]; then
|
||||
printf 'The host role requires RENDEZVOUS_PUBLISHER_CREDENTIAL.\n' >&2
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
if [[ ! "$LISTING_ID" =~ ^[0-9a-fA-F-]{36}$ ]]; then
|
||||
if [[ ! "$LISTING_ID" =~ $UUID_PATTERN ]]; then
|
||||
printf 'A client role requires a UUID in RENDEZVOUS_CANARY_LISTING_ID.\n' >&2
|
||||
exit 2
|
||||
fi
|
||||
@@ -168,7 +173,7 @@ if [[ "$ROLE" == host ]]; then
|
||||
exit 1
|
||||
fi
|
||||
observed_listing="$(jq -r 'select(.event == "host.registered") | .listingId' "$raw_log" | tail -n 1)"
|
||||
if [[ ! "$observed_listing" =~ ^[0-9a-f-]{36}$ ]]; then
|
||||
if [[ ! "$observed_listing" =~ $UUID_PATTERN ]]; then
|
||||
printf 'The canary host did not produce a valid coordination identifier.\n' >&2
|
||||
kill -TERM "$host_pid" 2>/dev/null || true
|
||||
wait "$host_pid" 2>/dev/null || true
|
||||
@@ -176,9 +181,8 @@ if [[ "$ROLE" == host ]]; then
|
||||
fi
|
||||
coordination_parent="$(dirname "$COORDINATION_FILE")"
|
||||
mkdir -p "$coordination_parent"
|
||||
coordination_temp="$COORDINATION_FILE.tmp.$$"
|
||||
coordination_temp="$(mktemp "$COORDINATION_FILE.tmp.XXXXXXXX")"
|
||||
printf '%s\n' "$observed_listing" >"$coordination_temp"
|
||||
chmod 600 "$coordination_temp"
|
||||
mv "$coordination_temp" "$COORDINATION_FILE"
|
||||
printf 'Host ready; securely transfer the private coordination file to the client operator.\n'
|
||||
set +e
|
||||
@@ -219,6 +223,10 @@ else
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$OUTPUT")"
|
||||
raw_retention=deleted-after-success
|
||||
if [[ "$KEEP_RAW" == true ]]; then
|
||||
raw_retention=retained-private-on-request
|
||||
fi
|
||||
jq -n \
|
||||
--arg commit "$commit" \
|
||||
--arg treeState "$tree_state" \
|
||||
@@ -226,8 +234,9 @@ jq -n \
|
||||
--arg role "$ROLE" \
|
||||
--arg topology "$TOPOLOGY" \
|
||||
--arg addressFamily "$ADDRESS_FAMILY" \
|
||||
--arg rawEvents "$raw_retention" \
|
||||
--argjson checks "$checks" \
|
||||
'{schemaVersion:1,kind:"rendezvous-real-network-canary",commit:$commit,treeState:$treeState,timestampUtc:$timestampUtc,role:$role,topology:$topology,addressFamily:$addressFamily,result:"pass",checks:$checks,dataRetention:{rawEvents:"deleted-after-success",identifiers:"not-in-summary",networkEndpoints:"not-in-summary"}}' \
|
||||
'{schemaVersion:1,kind:"rendezvous-real-network-canary",commit:$commit,treeState:$treeState,timestampUtc:$timestampUtc,role:$role,topology:$topology,addressFamily:$addressFamily,result:"pass",checks:$checks,dataRetention:{rawEvents:$rawEvents,identifiers:"not-in-summary",networkEndpoints:"not-in-summary"}}' \
|
||||
>"$OUTPUT"
|
||||
|
||||
run_succeeded=true
|
||||
|
||||
Reference in New Issue
Block a user