Skip to content

Commit 35fe76b

Browse files
committed
ci(e2e): add run-id label to infra resources for cleanup
Signed-off-by: Anton Yachmenev <[email protected]>
1 parent c183633 commit 35fe76b

File tree

2 files changed

+82
-8
lines changed

2 files changed

+82
-8
lines changed

.github/workflows/e2e-matrix.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,23 @@ jobs:
177177
uses: actions/download-artifact@v4
178178
with:
179179
name: nested-run-${{ env.RUN_ID }}
180-
path: .
180+
path: ci/dvp-e2e/tmp/runs/${{ env.RUN_ID }}
181+
merge-multiple: true
181182

182183
- name: Configure kubeconfig env
184+
working-directory: ci/dvp-e2e
185+
env:
186+
RUN_ID: ${{ env.RUN_ID }}
183187
run: |
184-
set -euo pipefail
185-
NESTED_KUBECONFIG="${GITHUB_WORKSPACE}/ci/dvp-e2e/tmp/runs/${RUN_ID}/nested/kubeconfig"
186-
if [ ! -s "$NESTED_KUBECONFIG" ]; then
187-
echo "[ERR] Nested kubeconfig not found at $NESTED_KUBECONFIG" >&2
188-
exit 1
189-
fi
190-
echo "KUBECONFIG=$NESTED_KUBECONFIG" >> "$GITHUB_ENV"
188+
task ci:kubeconfig:ensure
189+
190+
- name: Pause for manual inspection
191+
working-directory: ci/dvp-e2e
192+
env:
193+
RUN_ID: ${{ env.RUN_ID }}
194+
MANUAL_WAIT_SECONDS: ${{ vars.MANUAL_WAIT_SECONDS || '7200' }}
195+
run: |
196+
task ci:manual-wait
191197
192198
- name: Run E2E tests
193199
working-directory: test/e2e

ci/dvp-e2e/Taskfile.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,3 +623,71 @@ tasks:
623623
TMP_DIR: "{{ .TMP_DIR }}"
624624
NESTED_KUBECONFIG: "{{ .NESTED_KUBECONFIG }}"
625625
SDS_SC_NAME: "{{ .SDS_SC_NAME }}"
626+
ci:kubeconfig:ensure:
627+
desc: Ensure nested kubeconfig exists at the expected path
628+
vars:
629+
RUN_ID: '{{ .RUN_ID | default (env "RUN_ID") | default "" }}'
630+
WORKSPACE:
631+
sh: git rev-parse --show-toplevel 2>/dev/null || pwd
632+
cmds:
633+
- |
634+
set -euo pipefail
635+
RUN_ID="{{ .RUN_ID }}"
636+
if [ -z "$RUN_ID" ]; then
637+
echo "[ERR] RUN_ID must be provided to locate nested kubeconfig" >&2
638+
exit 1
639+
fi
640+
WORKSPACE="${GITHUB_WORKSPACE:-{{ .WORKSPACE }}}"
641+
TARGET_PATH="$WORKSPACE/ci/dvp-e2e/tmp/runs/$RUN_ID/nested/kubeconfig"
642+
if [ ! -s "$TARGET_PATH" ]; then
643+
echo "[ERR] Nested kubeconfig not found at $TARGET_PATH" >&2
644+
exit 1
645+
fi
646+
echo "[INFO] Using nested kubeconfig at $TARGET_PATH"
647+
[ -n "${GITHUB_ENV:-}" ] && echo "KUBECONFIG=$TARGET_PATH" >> "$GITHUB_ENV"
648+
ci:manual-wait:
649+
desc: Pause execution to allow manual SSH inspection of nested cluster
650+
vars:
651+
RUN_ID: '{{ .RUN_ID | default (env "RUN_ID") | default "" }}'
652+
WORKSPACE:
653+
sh: git rev-parse --show-toplevel 2>/dev/null || pwd
654+
WAIT_SECONDS: '{{ .WAIT_SECONDS | default (env "MANUAL_WAIT_SECONDS") | default "7200" }}'
655+
cmds:
656+
- |
657+
set -euo pipefail
658+
RUN_ID="{{ .RUN_ID }}"
659+
WAIT="{{ .WAIT_SECONDS }}"
660+
if [ -z "$RUN_ID" ]; then
661+
echo "[ERR] RUN_ID must be set for ci:manual-wait" >&2
662+
exit 1
663+
fi
664+
if ! [[ "$WAIT" =~ ^[0-9]+$ ]]; then
665+
echo "[ERR] WAIT_SECONDS must be numeric (got '$WAIT')" >&2
666+
exit 1
667+
fi
668+
if [ "$WAIT" -le 0 ]; then
669+
echo "[INFO] Manual wait skipped (WAIT_SECONDS=$WAIT)"
670+
exit 0
671+
fi
672+
WORKSPACE='{{ .WORKSPACE }}'
673+
PARENT_KUBECONFIG="$WORKSPACE/ci/dvp-e2e/tmp/runs/$RUN_ID/parent.kubeconfig"
674+
echo "[INFO] Pausing for $WAIT seconds before running tests."
675+
echo "[INFO] Use parent kubeconfig for SSH tunneling:"
676+
echo " export KUBECONFIG=$PARENT_KUBECONFIG"
677+
echo " d8 v ssh --namespace $RUN_ID --username ubuntu <vm-name>"
678+
echo "[INFO] Press Ctrl+C in the workflow run to cancel wait early."
679+
START_TS=$(date +%s)
680+
END=$((START_TS + WAIT))
681+
LAST_NOTE=$START_TS
682+
while true; do
683+
NOW=$(date +%s)
684+
[ "$NOW" -ge "$END" ] && break
685+
REM=$((END - NOW))
686+
printf '[INFO] Manual wait: %d seconds remaining...\n' "$REM"
687+
if [ $((NOW - LAST_NOTE)) -ge 300 ]; then
688+
echo "[INFO] Cluster should be ready for manual SSH troubleshooting."
689+
LAST_NOTE=$NOW
690+
fi
691+
sleep 60 || true
692+
done
693+
echo "[INFO] Manual wait finished; proceeding to tests."

0 commit comments

Comments
 (0)