fix: resolve resume workflow ID in logs command
Strip _resume_* suffix to find the original workspace log file when tailing logs for a resumed workflow.
This commit is contained in:
@@ -253,6 +253,11 @@ cmd_logs() {
|
|||||||
|
|
||||||
if [ -f "./audit-logs/${ID}/workflow.log" ]; then
|
if [ -f "./audit-logs/${ID}/workflow.log" ]; then
|
||||||
WORKFLOW_LOG="./audit-logs/${ID}/workflow.log"
|
WORKFLOW_LOG="./audit-logs/${ID}/workflow.log"
|
||||||
|
else
|
||||||
|
# For resume workflow IDs (e.g. workspace_resume_123), check the original workspace
|
||||||
|
WORKSPACE_ID="${ID%%_resume_*}"
|
||||||
|
if [ "$WORKSPACE_ID" != "$ID" ] && [ -f "./audit-logs/${WORKSPACE_ID}/workflow.log" ]; then
|
||||||
|
WORKFLOW_LOG="./audit-logs/${WORKSPACE_ID}/workflow.log"
|
||||||
else
|
else
|
||||||
# Search for the workflow directory (handles custom OUTPUT paths)
|
# Search for the workflow directory (handles custom OUTPUT paths)
|
||||||
FOUND=$(find . -maxdepth 3 -path "*/${ID}/workflow.log" -type f 2>/dev/null | head -1)
|
FOUND=$(find . -maxdepth 3 -path "*/${ID}/workflow.log" -type f 2>/dev/null | head -1)
|
||||||
@@ -260,6 +265,7 @@ cmd_logs() {
|
|||||||
WORKFLOW_LOG="$FOUND"
|
WORKFLOW_LOG="$FOUND"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$WORKFLOW_LOG" ]; then
|
if [ -n "$WORKFLOW_LOG" ]; then
|
||||||
echo "Tailing workflow log: $WORKFLOW_LOG"
|
echo "Tailing workflow log: $WORKFLOW_LOG"
|
||||||
|
|||||||
Reference in New Issue
Block a user