Skip to content

Commit 3b828d9

Browse files
committed
test: Implementation to handle changed format for .node folder from X.Y.Z-<tag> to X.Y.Z
Updated startup-localenv-with-data.sh to handle the format change in .node directory structure: - Previously: .node/X.Y.Z-<tag>/ (e.g., .node/0.18.0-rc.11/) - Now: .node/X.Y.Z/ (e.g., .node/0.18.0/) Implementation details: - Extract base version (X.Y.Z) from NODE_TAG by removing tag suffix - Prioritize new format (.node/X.Y.Z/) first - Fallback to old format (.node/X.Y.Z-<tag>/) for backward compatibility - Provide clear error messages if neither format exists Tested scenarios: - NODE_TAG=0.18.0 → Uses .node/0.18.0/ (new format) ✓ - NODE_TAG=0.18.0-rc.11 → Uses .node/0.18.0/ (new format preferred) ✓ - Maintains backward compatibility with old format directories
1 parent 2e9365c commit 3b828d9

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

qa/scripts/startup-localenv-with-data.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,30 @@ echo "Volume name: $DOCKER_VOLUME_NAME"
5656
docker volume rm $DOCKER_VOLUME_NAME 2>/dev/null || true
5757
docker volume create $DOCKER_VOLUME_NAME
5858

59+
# Extract base version (X.Y.Z) from NODE_TAG, removing any tag suffix (e.g., "0.18.0-rc.11" -> "0.18.0")
60+
# This handles the format change from X.Y.Z-<tag> to X.Y.Z
61+
NODE_VERSION_BASE=$(echo "$NODE_TAG" | sed 's/-.*$//')
62+
63+
# Determine which .node directory format to use
64+
# Try new format (X.Y.Z) first, then fallback to old format (X.Y.Z-<tag>) for backward compatibility
65+
NODE_DATA_DIR=""
66+
if [ -d "$(pwd)/.node/$NODE_VERSION_BASE" ]; then
67+
NODE_DATA_DIR=".node/$NODE_VERSION_BASE"
68+
echo "Using new format .node directory: $NODE_DATA_DIR"
69+
elif [ -d "$(pwd)/.node/$NODE_TAG" ]; then
70+
NODE_DATA_DIR=".node/$NODE_TAG"
71+
echo "Using old format .node directory: $NODE_DATA_DIR"
72+
else
73+
echo "ERROR: Neither .node/$NODE_VERSION_BASE nor .node/$NODE_TAG directory found!"
74+
echo "Available .node directories:"
75+
ls -la .node/ 2>/dev/null || echo " (none found)"
76+
exit 1
77+
fi
78+
5979
# Use a temporary container to copy data into the volume
60-
echo "Copying fresh node data from .node/$NODE_TAG/ into volume..."
80+
echo "Copying fresh node data from $NODE_DATA_DIR/ into volume..."
6181
docker run --rm \
62-
-v "$(pwd)/.node/$NODE_TAG:/source:ro" \
82+
-v "$(pwd)/$NODE_DATA_DIR:/source:ro" \
6383
-v $DOCKER_VOLUME_NAME:/node \
6484
alpine sh -c "cp -r /source/. /node/ && chmod -R 777 /node/chain"
6585

0 commit comments

Comments
 (0)