Skip to content
This repository was archived by the owner on May 6, 2025. It is now read-only.

Commit 8170c6e

Browse files
committed
Fix build process for non-existing boxes
1 parent 0a6a7cc commit 8170c6e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ jobs:
9292
NAME="${BUILD%-*}"
9393
9494
# Check if the boxes (virtualbox/libvirt) with the same git hash already exists
95-
CURRENT_VERSION_DESCRIPTION_MARKDOWN="$(curl -L --silent "https://app.vagrantup.com/api/v1/box/${VAGRANT_CLOUD_USER}/${NAME}" | jq '.current_version.version as $current_version | .versions[] | select (.version == $current_version) .description_markdown')"
95+
if curl -s "https://app.vagrantup.com/${VAGRANT_CLOUD_USER}/boxes/${NAME}" | grep -q "Not found" ; then
96+
CURRENT_VERSION_DESCRIPTION_MARKDOWN="Box doesn't exist"
97+
else
98+
CURRENT_VERSION_DESCRIPTION_MARKDOWN="$(curl -L --silent "https://app.vagrantup.com/api/v1/box/${VAGRANT_CLOUD_USER}/${NAME}" | jq '.current_version.version as $current_version | .versions[] | select (.version == $current_version) .description_markdown')"
99+
fi
96100
if [[ "${CURRENT_VERSION_DESCRIPTION_MARKDOWN}" =~ ${GITHUB_SHA} ]] ; then
97101
echo "*** Git hash \"${GITHUB_SHA}\" found in current markdown description"
98102
# Skip build if the box already exists
@@ -198,16 +202,16 @@ jobs:
198202
if [[ "${NAME}" =~ ubuntu-.*-desktop-amd64 ]] && [[ "${VAGRANT_PROVIDER}" = "libvirt" ]] ; then
199203
continue
200204
fi
201-
CURRENT_VERSION=$(curl -s https://app.vagrantup.com/api/v1/box/peru/${NAME} | jq -r ".current_version.version")
202-
CHECKSUM=$(curl -s https://app.vagrantup.com/api/v1/box/peru/${NAME} | jq -r ".current_version.providers[] | select (.name == \"${VAGRANT_PROVIDER}\") .checksum")
203-
URL="https://app.vagrantup.com/peru/boxes/${NAME}/versions/${CURRENT_VERSION}/providers/${VAGRANT_PROVIDER}.box"
205+
CURRENT_VERSION=$(curl -s "https://app.vagrantup.com/api/v1/box/${VAGRANT_CLOUD_USER}/${NAME}" | jq -r ".current_version.version")
206+
CHECKSUM=$(curl -s "https://app.vagrantup.com/api/v1/box/${VAGRANT_CLOUD_USER}/${NAME}" | jq -r ".current_version.providers[] | select (.name == \"${VAGRANT_PROVIDER}\") .checksum")
207+
URL="https://app.vagrantup.com/${VAGRANT_CLOUD_USER}/boxes/${NAME}/versions/${CURRENT_VERSION}/providers/${VAGRANT_PROVIDER}.box"
204208
echo "*** ${URL} | ${CHECKSUM}"
205209
if ! curl -L --fail --silent --head --output /dev/null "${URL}"; then
206210
echo "* URL \"${URL}\" is not accessible !"
207211
exit 1
208212
fi
209-
if [ "$(curl -s "https://app.vagrantup.com/peru/boxes/${NAME}" | jq '.versions | length')" != "1" ]; then
210-
echo "* Too many versions for: https://app.vagrantup.com/peru/boxes/${NAME} !"
213+
if [ "$(curl -s "https://app.vagrantup.com/${VAGRANT_CLOUD_USER}/boxes/${NAME}" | jq '.versions | length')" != "1" ]; then
214+
echo "* Too many versions for: https://app.vagrantup.com/${VAGRANT_CLOUD_USER}/boxes/${NAME} !"
211215
exit 2
212216
fi
213217
done

0 commit comments

Comments
 (0)