diff --git a/.github/add-boxes.sh b/.github/add-boxes.sh new file mode 100755 index 0000000..62894f0 --- /dev/null +++ b/.github/add-boxes.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# add-boxes.sh +# list add boxes on system and add +# already present on the system. + +set -euo pipefail + +PROVIDER=virtualbox + +# Read the boxes that are currently present on the system (for the current provider) +present_boxes=$( + (vagrant box list | + grep "${PROVIDER}" | # Filter by boxes available for the current provider + awk '{print $1;}' | # The box name is the first word in each line + sort | + uniq) || + echo "" # In case any of these commands fails, just use an empty list +) + +# Add all boxes + echo "${present_boxes}" | while IFS= read -r box; do + vagrant box add --provider "${PROVIDER}" "${box}" + done diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 83cc5df..d03e4cc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,7 +58,7 @@ jobs: EOF - name: Add Vagrant Boxes - run: ./.github/download-boxes.sh + run: ./.github/add-boxes.sh - name: Install dependencies run: |