Skip to content

Commit 7109e93

Browse files
committed
reduce-snapshot should return original snapshot
When the single component retrieved does not exist in the SNAPSHOT parameter, the script should return the origin SNAPSHOT contents. Currently it is returning an empty list.
1 parent 81bcf73 commit 7109e93

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hack/reduce-snapshot.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ if [ "${SINGLE_COMPONENT}" == "true" ]; then
6363
jq --arg component "${SNAPSHOT_CREATION_COMPONENT}" \
6464
'del(.components[] | select(.name != $component))' "$WORKING_SNAPSHOT" > "$REDUCED_SNAPSHOT"
6565

66-
mv "$REDUCED_SNAPSHOT" "$WORKING_SNAPSHOT"
67-
## make sure we still have 1 component
68-
COMPONENT_COUNT=$(jq -r '[ .components[] ] | length' "$WORKING_SNAPSHOT")
69-
echo "COMPONENT_COUNT: ${COMPONENT_COUNT}"
70-
if [ "${COMPONENT_COUNT}" != "1" ] ; then
66+
COMPONENT_COUNT=$(jq -r '[ .components[] ] | length' "$REDUCED_SNAPSHOT")
67+
if [ "${COMPONENT_COUNT}" == "1" ]; then
68+
mv "$REDUCED_SNAPSHOT" "$WORKING_SNAPSHOT"
69+
else
7170
echo "Error: Reduced Snapshot has ${COMPONENT_COUNT} components. It should contain 1"
7271
echo " Verify that the Snapshot contains the built component: ${SNAPSHOT_CREATION_COMPONENT}"
73-
exit 1
72+
echo "Returning original Snapshot"
7473
fi
74+
7575
fi
7676
fi
7777

0 commit comments

Comments
 (0)