Last active
November 4, 2022 07:46
-
-
Save tyabu12/ced4e09ba42e5fd16f05fc037bd9efd0 to your computer and use it in GitHub Desktop.
Vagrant cloud upload script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USERNAME="CHANGE ME" | |
PROVIDER_NAME="virtualbox" | |
ACCESS_TOKEN="CHANGE ME" | |
set -eu | |
if [ $# -ne 3 ]; then | |
cat <<_EOT_ | |
Usage: | |
$0 <box_name> <version> <box_filepath> | |
_EOT_ | |
exit 1 | |
fi | |
BOX_NAME=$1 | |
VERSION=$2 | |
BOX_FILEPATH=$3 | |
UPLOAD_PATH=`curl -s "https://vagrantcloud.com/api/v1/box/${USERNAME}/${BOX_NAME}/version/${VERSION}/provider/${PROVIDER_NAME}/upload?access_token=${ACCESS_TOKEN}" | jq -r '.upload_path'` | |
echo "Uploading to $UPLOAD_PATH ..." | |
curl -X PUT --upload-file $BOX_FILEPATH $UPLOAD_PATH | |
echo "done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requirements
Reference
Creating a New Vagrant Box - Vagrant by HashiCorp