Skip to content

Commit 32c5c6b

Browse files
CopilotPDowney
andauthored
fix: improve CI run-install-step.sh error handling for log directory and tail failures
Agent-Logs-Url: https://github.com/EngineScript/EngineScript/sessions/251c9f84-fbb7-4e12-8638-03958c4819d7 Co-authored-by: PDowney <[email protected]>
1 parent d687db9 commit 32c5c6b

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ Changes are organized by date, with the most recent changes listed first.
66

77
## 2026-04-10
88

9+
### 🔧 CI RUN-INSTALL-STEP ERROR HANDLING IMPROVEMENTS
10+
11+
- Enhanced log directory validation in `scripts/ci/run-install-step.sh` to separately check for non-existent directories (`[ ! -d ]`) and inaccessible directories (`[ ! -x ]`) before attempting to resolve the path, providing more specific error messages instead of a single combined error.
12+
- Updated the fallback error message when `tail` fails to capture and display the actual error output from `tail`, making it easier to debug why log file contents could not be displayed.
13+
14+
15+
916
### 🔧 EXTERNAL SERVICES JS CODE QUALITY IMPROVEMENTS
1017

1118
- Extracted the duplicated category order list in `external-services.js` into a single module-level `CATEGORY_ORDER` constant shared by `getCategoryOrder()` and `getServiceOrder()`, eliminating the risk of inconsistencies when categories are added or changed.

scripts/ci/run-install-step.sh

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,21 @@ esac
4343
ALLOWED_LOG_BASE_DIR="$(pwd -P)"
4444
LOG_PARENT_DIR="$(dirname -- "$LOG_PATH")"
4545
LOG_FILENAME="$(basename -- "$LOG_PATH")"
46+
47+
if [ ! -d "$LOG_PARENT_DIR" ]; then
48+
echo "Error: log directory does not exist: $LOG_PARENT_DIR" >&2
49+
exit 1
50+
fi
51+
52+
if [ ! -x "$LOG_PARENT_DIR" ]; then
53+
echo "Error: log directory is not accessible (missing execute permission): $LOG_PARENT_DIR" >&2
54+
exit 1
55+
fi
56+
4657
RESOLVED_LOG_PARENT="$(cd "$LOG_PARENT_DIR" 2>/dev/null && pwd -P)"
4758

4859
if [ -z "${RESOLVED_LOG_PARENT:-}" ]; then
49-
echo "Error: log directory does not exist or is not accessible: $LOG_PARENT_DIR" >&2
60+
echo "Error: unable to resolve log directory path: $LOG_PARENT_DIR" >&2
5061
exit 1
5162
fi
5263

@@ -113,7 +124,14 @@ if [ "$SCRIPT_EXIT_CODE" -ne 0 ]; then
113124
fi
114125
echo "Script end time: $(date)" >> "$LOG_PATH"
115126
echo "Last 50 lines of output:"
116-
tail -50 "$LOG_PATH" || echo "Failed to display log file contents: $LOG_PATH"
127+
TAIL_OUTPUT="$(tail -50 "$LOG_PATH" 2>&1)"
128+
TAIL_EXIT_CODE=$?
129+
if [ "$TAIL_EXIT_CODE" -eq 0 ]; then
130+
echo "$TAIL_OUTPUT"
131+
else
132+
echo "Failed to display log file contents: $LOG_PATH"
133+
echo "tail error: $TAIL_OUTPUT"
134+
fi
117135

118136
exit 1
119137
fi

0 commit comments

Comments
 (0)