|
10 | 10 | tail: |
11 | 11 | description: "Log lines to tail per pod" |
12 | 12 | required: false |
13 | | - default: "800" |
| 13 | + default: "2000" |
| 14 | + since: |
| 15 | + description: "Only logs newer than this (e.g. 1h, 30m, 2026-07-08T14:00:00Z)" |
| 16 | + required: false |
| 17 | + default: "1h" |
14 | 18 | grep: |
15 | 19 | description: "Optional case-insensitive filter (e.g. SubmitPost, Traceback, 500)" |
16 | 20 | required: false |
@@ -46,36 +50,38 @@ jobs: |
46 | 50 | - name: Collect pod status + logs |
47 | 51 | env: |
48 | 52 | TAIL: ${{ github.event.inputs.tail }} |
| 53 | + SINCE: ${{ github.event.inputs.since }} |
49 | 54 | GREP: ${{ github.event.inputs.grep }} |
50 | 55 | PREVIOUS: ${{ github.event.inputs.previous }} |
51 | 56 | run: | |
52 | 57 | NS=jaseci-blogs |
53 | 58 | DEPLOY=deployment/jaseci-blogs |
| 59 | + # tee everything to BOTH the step log (CLI-readable) and the job summary. |
54 | 60 | { |
55 | 61 | echo "## jaseci-blogs pod diagnostics" |
56 | | - echo "_$(date -u) — tail=${TAIL:-800} grep='${GREP}' previous=${PREVIOUS}_" |
| 62 | + echo "_$(date -u) — since=${SINCE:-1h} tail=${TAIL:-2000} grep='${GREP}' previous=${PREVIOUS}_" |
57 | 63 | echo "" |
58 | 64 | echo "### Pods" |
59 | 65 | echo '```' |
60 | 66 | kubectl get pods -n "$NS" -o wide 2>&1 || true |
61 | 67 | echo '```' |
62 | | - echo "### App logs ($DEPLOY)" |
| 68 | + echo "### App logs ($DEPLOY, since ${SINCE:-1h})" |
63 | 69 | echo '```' |
64 | 70 | if [ -n "$GREP" ]; then |
65 | | - kubectl logs -n "$NS" "$DEPLOY" --all-containers --timestamps --tail="${TAIL:-800}" 2>&1 \ |
| 71 | + kubectl logs -n "$NS" "$DEPLOY" --all-containers --timestamps --since="${SINCE:-1h}" --tail="${TAIL:-2000}" 2>&1 \ |
66 | 72 | | grep -iE "$GREP" || echo "(no lines matched '$GREP')" |
67 | 73 | else |
68 | | - kubectl logs -n "$NS" "$DEPLOY" --all-containers --timestamps --tail="${TAIL:-800}" 2>&1 || true |
| 74 | + kubectl logs -n "$NS" "$DEPLOY" --all-containers --timestamps --since="${SINCE:-1h}" --tail="${TAIL:-2000}" 2>&1 || true |
69 | 75 | fi |
70 | 76 | echo '```' |
71 | 77 | if [ "$PREVIOUS" = "true" ]; then |
72 | 78 | echo "### Previous (crashed) container logs" |
73 | 79 | echo '```' |
74 | | - kubectl logs -n "$NS" "$DEPLOY" --all-containers --previous --tail="${TAIL:-800}" 2>&1 || echo "(no previous container)" |
| 80 | + kubectl logs -n "$NS" "$DEPLOY" --all-containers --previous --tail="${TAIL:-2000}" 2>&1 || echo "(no previous container)" |
75 | 81 | echo '```' |
76 | 82 | fi |
77 | 83 | echo "### describe (events / restarts)" |
78 | 84 | echo '```' |
79 | 85 | kubectl describe pods -n "$NS" -l app=jaseci-blogs 2>&1 | tail -60 || true |
80 | 86 | echo '```' |
81 | | - } >> "$GITHUB_STEP_SUMMARY" |
| 87 | + } | tee -a "$GITHUB_STEP_SUMMARY" |
0 commit comments