echo"Unable to pull any previous deployments for redeployment"
return1
fi
localredeploy_res=$(curl -X POST "https://api.vercel.com/v13/deployments?forceNew=1&skipAutoDetectionConfirmation=1&slug=$VERCEL_TEAM_SLUG&teamId=$VERCEL_TEAM_ID"\
--fail \
--silent \
--output "/dev/null"\
-H "Authorization: Bearer $VERCEL_API_KEY"\
-H "Content-Type: application/json"\
-d "{
"deploymentId": $latest_id,
}"
)
echo$redeploy_res
}
# Check each module's accessibility
for module in "${modules[@]}";do
# Trim leading/trailing whitespace from module name
@ -96,6 +138,8 @@ if (( status == 0 )); then
echo"All modules are operational."
# set to
update_component_status "OPERATIONAL"
echo"JUST_REDEPLOYED=0" >> $GITHUB_ENV
else
echo"The following modules have issues: ${failures[*]}"
# check if all modules are down
@ -108,6 +152,20 @@ else
# Create a new incident
incident_id=$(create_incident)
echo"Created incident with ID: $incident_id"
# If a module is down, force a reployment to try getting things back online
# ASAP
status_code=$(force_redeploy_registry)
# shellcheck disable=SC2181
if((status_code==200));then
echo"Reployment successful"
else
echo"Unable to redeploy automatically"
fi
# Update environment variable so that if automatic re-deployment fails, we
# don't keep running the script over and over again