Loading functions.sh +21 −9 Original line number Original line Diff line number Diff line Loading @@ -80,19 +80,31 @@ function upload_to_vagrant_cloud() { # Exit on any error # Exit on any error set -e set -e # create new box (don't check the status because it will return 422 if the box exists) # create new box (don't check the status because it will return 422 if the box exists) http --session=vagrantup --ignore-stdin POST ${VAGRANTCLOUD_API_URL}/boxes "Authorization: Bearer ${VAGRANTCLOUD_TOKEN}" \ curl \ box:="{\"username\": \"esss\", \"name\": \"${box_name}\", \"is_private\": false}" --header "Content-Type: application/json" \ --header "Authorization: Bearer $VAGRANTCLOUD_TOKEN" \ ${VAGRANTCLOUD_API_URL}/boxes \ --data "{ \"box\": { \"username\": \"myuser\", \"name\": \"${box_name}\", \"is_private\": false } }" # create new version # create new version http --session=vagrantup --check-status --ignore-stdin POST ${box_api_url}/versions \ curl \ version:="{\"version\": \"${box_version}\"}" --header "Content-Type: application/json" \ --header "Authorization: Bearer $VAGRANTCLOUD_TOKEN" \ ${box_api_url}/versions \ --data "{ \"version\": { \"version\": \"${box_version}\" } }" # create new provider # create new provider http --session=vagrantup --check-status --ignore-stdin POST ${box_api_url}/version/${box_version}/providers \ curl \ provider:='{"name": "virtualbox"}' --header "Content-Type: application/json" \ --header "Authorization: Bearer $VAGRANTCLOUD_TOKEN" \ ${box_api_url}/version/${box_version}/providers \ --data '{ "provider": { "name": "virtualbox" } }' # get the path to upload the box # get the path to upload the box upload_path=$(http --session=vagrantup --check-status --ignore-stdin \ upload_path=$(curl --header "Authorization: Bearer $VAGRANTCLOUD_TOKEN" \ ${box_api_url}/version/${box_version}/provider/virtualbox/upload | jq -r .upload_path) ${box_api_url}/version/${box_version}/provider/virtualbox/upload | jq -r .upload_path) # upload the box # upload the box http --session=vagrantup --check-status --ignore-stdin PUT ${upload_path} @${box_path} curl $upload_path --request PUT --upload-file ${box_path} # release the new version # release the new version http --session=vagrantup --check-status --ignore-stdin PUT ${box_api_url}/version/${box_version}/release curl \ --header "Authorization: Bearer $VAGRANTCLOUD_TOKEN" \ --request PUT \ ${box_api_url}/version/${box_version}/release } } Loading
functions.sh +21 −9 Original line number Original line Diff line number Diff line Loading @@ -80,19 +80,31 @@ function upload_to_vagrant_cloud() { # Exit on any error # Exit on any error set -e set -e # create new box (don't check the status because it will return 422 if the box exists) # create new box (don't check the status because it will return 422 if the box exists) http --session=vagrantup --ignore-stdin POST ${VAGRANTCLOUD_API_URL}/boxes "Authorization: Bearer ${VAGRANTCLOUD_TOKEN}" \ curl \ box:="{\"username\": \"esss\", \"name\": \"${box_name}\", \"is_private\": false}" --header "Content-Type: application/json" \ --header "Authorization: Bearer $VAGRANTCLOUD_TOKEN" \ ${VAGRANTCLOUD_API_URL}/boxes \ --data "{ \"box\": { \"username\": \"myuser\", \"name\": \"${box_name}\", \"is_private\": false } }" # create new version # create new version http --session=vagrantup --check-status --ignore-stdin POST ${box_api_url}/versions \ curl \ version:="{\"version\": \"${box_version}\"}" --header "Content-Type: application/json" \ --header "Authorization: Bearer $VAGRANTCLOUD_TOKEN" \ ${box_api_url}/versions \ --data "{ \"version\": { \"version\": \"${box_version}\" } }" # create new provider # create new provider http --session=vagrantup --check-status --ignore-stdin POST ${box_api_url}/version/${box_version}/providers \ curl \ provider:='{"name": "virtualbox"}' --header "Content-Type: application/json" \ --header "Authorization: Bearer $VAGRANTCLOUD_TOKEN" \ ${box_api_url}/version/${box_version}/providers \ --data '{ "provider": { "name": "virtualbox" } }' # get the path to upload the box # get the path to upload the box upload_path=$(http --session=vagrantup --check-status --ignore-stdin \ upload_path=$(curl --header "Authorization: Bearer $VAGRANTCLOUD_TOKEN" \ ${box_api_url}/version/${box_version}/provider/virtualbox/upload | jq -r .upload_path) ${box_api_url}/version/${box_version}/provider/virtualbox/upload | jq -r .upload_path) # upload the box # upload the box http --session=vagrantup --check-status --ignore-stdin PUT ${upload_path} @${box_path} curl $upload_path --request PUT --upload-file ${box_path} # release the new version # release the new version http --session=vagrantup --check-status --ignore-stdin PUT ${box_api_url}/version/${box_version}/release curl \ --header "Authorization: Bearer $VAGRANTCLOUD_TOKEN" \ --request PUT \ ${box_api_url}/version/${box_version}/release } }