Browse files

Add a backup for CI build provisioning

  • Loading branch information...
clong committed Dec 7, 2018
1 parent 52faea3 commit 0f5d5b95b4b231ff706695c6894fdb93c3373a3c
Showing with 7 additions and 1 deletion.
  1. +7 −1 ci/circle_workflows/
@@ -14,7 +14,13 @@ DEVICE_ID=$(curl -s -X POST --header 'Accept: application/json' --header 'Conten
# TODO: maybe make this a regex
if [ "$(echo -n $DEVICE_ID | wc -c)" -ne 36 ]; then
echo "Server may have failed provisionining. Device ID is set to: $DEVICE_ID"
exit 1
echo "This usually happens if there are no servers available in the selected datacenter."
echo "Attempting to retry in another datacenter..."
DEVICE_ID=$(curl -s -X POST --header 'Accept: application/json' --header 'Content-Type: application/json' --header 'X-Auth-Token: '"$PACKET_API_TOKEN" -d '{ "facility": "ewr1", "plan": "baremetal_1", "hostname": "detectionlab", "description": "testing", "billing_cycle": "hourly", "operating_system": "ubuntu_16_04", "userdata": "", "locked": "false", "project_ssh_keys": ["315a9565-d5b1-41b6-913d-fcf022bb89a6", "755b134a-f63c-4fc5-9103-c1b63e65fdfc"] }' '' | jq ."id" | tr -d '"')
if [ "$(echo -n $DEVICE_ID | wc -c)" -ne 36 ]; then
echo "This script was still unable to successfully provision a server. Exiting."
exit 1
echo "Server successfully provisioned with ID: $DEVICE_ID"

0 comments on commit 0f5d5b9

Please sign in to comment.