Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions tools/populate/populate-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash
# Populate an Oxide lab host running Omicron with images from server catacomb.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to do a set -eu for this script?

As an example, if someone tries running without the oxide CLI installed, it'll keep trying to do work, even after multiple failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


set -eu
CATACOMB_TUNNEL="[fd00:1122:3344:101::1]:8080"
res=0
echo "Populating debian"
oxide api /images --method POST --input - <<EOF
{
"name": "debian",
"description": "debian",
"block_size": 512,
"distribution": {
"name": "debian",
"version": "11"
},
"source": {
"type": "url",
"url": "http://${CATACOMB_TUNNEL}/media/debian/debian-11-nocloud-amd64-20220503-998.raw"
}
}
EOF

echo "Populating focal"
oxide api /images --method POST --input - <<EOF
{
"name": "focal",
"description": "focal",
"block_size": 512,
"distribution": {
"name": "focal",
"version": "1"
},
"source": {
"type": "url",
"url": "http://${CATACOMB_TUNNEL}/media/cloud/focal-server-cloudimg-amd64.raw"
}
}
EOF

echo "Populating ubuntu"
oxide api /images --method POST --input - <<EOF
{
"name": "ubuntu",
"description": "ubuntu",
"block_size": 512,
"distribution": {
"name": "ubuntu",
"version": "22.04"
},
"source": {
"type": "url",
"url": "http://${CATACOMB_TUNNEL}/media/ubuntu/ubuntu-22.04-live-server-amd64.iso"
}
}
EOF

# A sanity check to see if access is working to catacomb
curl_test=$(curl -w '%{http_code}\n' -s -o /dev/null http://${CATACOMB_TUNNEL}/media/test.txt)
if [[ $curl_test -eq 200 ]]; then
echo "✔ Curl test to catacomb worked"
else
echo "To use these images, you need to have network access"
echo "to the catacomb lab system at ${CATACOMB_TUNNEL}"
echo ""
echo "For example, I run this from the system \"sock\" to set up a tunnel:"
echo "ssh -L ${CATACOMB_TUNNEL}:catacomb:80 catacomb"
echo "Leave that running in a different window while access is required"
echo ""
echo "Test of curl to catacomb failed"
echo "curl http://${CATACOMB_TUNNEL}/media/test.txt"
res=1
fi
exit $res