ci: make runner disk grow detection robust
Some checks failed
Deploy to Frontend Servers / deploy (push) Failing after 3s

This commit is contained in:
TerryM
2026-06-09 01:12:07 +08:00
parent 5724d2b08c
commit 41d737da11
2 changed files with 23 additions and 3 deletions

View File

@@ -16,17 +16,37 @@ jobs:
echo "=== Disk before resize ===" echo "=== Disk before resize ==="
df -h / df -h /
lsblk -o NAME,SIZE,TYPE,MOUNTPOINT,FSTYPE,PKNAME,PARTN || true
ROOT_SOURCE=$(findmnt -n -o SOURCE / 2>/dev/null || true) ROOT_SOURCE=$(findmnt -n -o SOURCE / 2>/dev/null || true)
ROOT_FSTYPE=$(findmnt -n -o FSTYPE / 2>/dev/null || true) ROOT_FSTYPE=$(findmnt -n -o FSTYPE / 2>/dev/null || true)
DISK_NAME=$(lsblk -no PKNAME "$ROOT_SOURCE" 2>/dev/null | head -n1 || true) DISK_NAME=$(lsblk -no PKNAME "$ROOT_SOURCE" 2>/dev/null | head -n1 || true)
PART_NUM=$(lsblk -no PARTN "$ROOT_SOURCE" 2>/dev/null | head -n1 || true) PART_NUM=$(lsblk -no PARTN "$ROOT_SOURCE" 2>/dev/null | head -n1 || true)
echo "Root source: $ROOT_SOURCE ($ROOT_FSTYPE)" # Fallback for NVMe device names if lsblk does not expose PKNAME/PARTN
# in the runner container. Example: /dev/nvme0n1p1 -> /dev/nvme0n1 + 1.
if [ -z "$DISK_NAME" ] || [ -z "$PART_NUM" ]; then
case "$ROOT_SOURCE" in
/dev/nvme*n*p*)
DISK_NAME=$(basename "$ROOT_SOURCE" | sed 's/p[0-9]*$//')
PART_NUM=$(basename "$ROOT_SOURCE" | sed 's/.*p//')
;;
/dev/*[0-9])
DISK_NAME=$(basename "$ROOT_SOURCE" | sed 's/[0-9]*$//')
PART_NUM=$(basename "$ROOT_SOURCE" | sed 's/.*[^0-9]//')
;;
esac
fi
echo "Root source: $ROOT_SOURCE ($ROOT_FSTYPE), disk: /dev/${DISK_NAME:-unknown}, partition: ${PART_NUM:-unknown}"
if [ -n "$DISK_NAME" ] && [ -n "$PART_NUM" ]; then if [ -n "$DISK_NAME" ] && [ -n "$PART_NUM" ]; then
if ! command -v growpart >/dev/null 2>&1; then
sudo dnf -y install cloud-utils-growpart || sudo yum -y install cloud-utils-growpart || true
fi
if command -v growpart >/dev/null 2>&1; then if command -v growpart >/dev/null 2>&1; then
sudo growpart "/dev/$DISK_NAME" "$PART_NUM" || true sudo growpart "/dev/$DISK_NAME" "$PART_NUM" || true
else else
echo "growpart not installed; skipping partition grow." echo "growpart not installed; cannot grow partition automatically."
fi fi
fi fi

View File

@@ -59,7 +59,7 @@ sudo resize2fs <root-partition> # ext filesystems
# or sudo xfs_growfs / # xfs filesystems # or sudo xfs_growfs / # xfs filesystems
``` ```
If that step says `growpart not installed`, install `cloud-utils-growpart` on the runner host and rerun the workflow. If the step cannot find `growpart`, it tries to install `cloud-utils-growpart` with `dnf`/`yum`. If install is blocked, install it manually on the runner host and rerun the workflow. The step also prints `lsblk`; if the parent disk still shows 8GB there, AWS has not attached/refreshed the expanded EBS volume for this instance.
### Node version is too old ### Node version is too old