ci: add E2E preflight check for Headlamp connectivity and plugin version (#24)

Adds a diagnostic step before E2E tests that:
- Logs the expected plugin version from package.json
- Verifies Headlamp is reachable (fails fast if not)
- Attempts to list installed plugins for debugging

This surfaces version mismatches and connectivity issues immediately
instead of requiring analysis of cryptic test timeout failures.

Co-authored-by: gandalf-the-greybeard[bot] <gandalf-the-greybeard[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit was merged in pull request #24.
This commit is contained in:
hugh-hackman[bot]
2026-03-08 21:07:46 -04:00
committed by GitHub
parent 0bd5223587
commit 29bc953522
+30
View File
@@ -25,6 +25,36 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Preflight — verify Headlamp connectivity
env:
HEADLAMP_URL: ${{ secrets.HEADLAMP_URL || 'http://headlamp.kube-system.svc.cluster.local' }}
run: |
echo "::group::Expected plugin version"
EXPECTED=$(node -p "require('./package.json').version")
echo "Plugin version in repo: $EXPECTED"
echo "::endgroup::"
echo "::group::Headlamp connectivity"
HTTP_CODE=$(curl -s -o /dev/null -w '%{http_code}' --connect-timeout 10 "$HEADLAMP_URL" || true)
if [ "$HTTP_CODE" = "000" ]; then
echo "::error::Cannot reach Headlamp at $HEADLAMP_URL — E2E tests will fail"
exit 1
fi
echo "Headlamp responded with HTTP $HTTP_CODE at $HEADLAMP_URL"
echo "::endgroup::"
echo "::group::Installed plugins"
# Headlamp serves plugin metadata at /plugins — no auth required
curl -sf --connect-timeout 10 "$HEADLAMP_URL/plugins" 2>/dev/null \
| node -e "
const d = require('fs').readFileSync(0,'utf8');
try {
const plugins = JSON.parse(d);
for (const p of plugins) console.log(' ' + p.name + '@' + (p.version||'unknown'));
} catch { console.log(' (could not parse plugin list)'); }
" || echo " (plugin list endpoint not available — tests will validate at runtime)"
echo "::endgroup::"
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium