fix(script): fixed yq

This commit is contained in:
Timothy Stewart 2024-03-25 13:36:08 -05:00
parent a204ed5169
commit 604eb7a6e6

View File

@ -9,15 +9,17 @@ set -euo pipefail
GIT_ROOT=$(git rev-parse --show-toplevel) GIT_ROOT=$(git rev-parse --show-toplevel)
PROVIDER=virtualbox PROVIDER=virtualbox
# requires yq 3
yq --version yq --version
# Read all boxes for all platforms from the "molecule.yml" files # Define the path to the molecule.yml files
all_boxes=$(cat "${GIT_ROOT}"/molecule/*/molecule.yml | MOLECULE_YML_PATH="${GIT_ROOT}/molecule/*/molecule.yml"
yq r '.platforms[].box' | # Read the "box" property of each node under "platforms"
grep --invert-match --regexp=--- | # Filter out file separators # Extract and sort unique boxes from all molecule.yml files
sort | all_boxes=$(for file in $MOLECULE_YML_PATH; do
uniq) yq eval '.platforms[].box' "$file"
done | sort -u)
echo all_boxes: "$all_boxes"
# Read the boxes that are currently present on the system (for the current provider) # Read the boxes that are currently present on the system (for the current provider)
present_boxes=$( present_boxes=$(