From 7603dfeb2982b3a14b0769c05a4286afa83e4269 Mon Sep 17 00:00:00 2001 From: "hugh-hackman[bot]" <266376744+hugh-hackman[bot]@users.noreply.github.com> Date: Mon, 9 Mar 2026 13:16:16 -0400 Subject: [PATCH] ci: improve E2E preflight with version mismatch detection (#32) Enhances the preflight step to: - Check the deployed plugin version against the repo version - Emit a clear warning annotation when there's a mismatch - Report the plugin name from artifacthub metadata - Still runs tests (warning, not error) so we catch other issues This makes plugin version mismatches immediately visible in the CI summary instead of requiring investigators to dig through 14 timeout failures. Co-authored-by: hugh-hackman[bot] Co-authored-by: Claude Opus 4.6 --- .github/workflows/e2e.yaml | 48 +++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 2c72a3c..9685c69 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -25,35 +25,45 @@ jobs: - name: Install dependencies run: npm ci - - name: Preflight — verify Headlamp connectivity + - name: Preflight — verify Headlamp and plugin version 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::" + PLUGIN_NAME=$(node -p "require('./package.json').artifacthub?.name || require('./package.json').name") + echo "Expected: $PLUGIN_NAME@$EXPECTED" - echo "::group::Headlamp connectivity" + # Check 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" + echo "::error::Cannot reach Headlamp at $HEADLAMP_URL" exit 1 fi - echo "Headlamp responded with HTTP $HTTP_CODE at $HEADLAMP_URL" - echo "::endgroup::" + echo "Headlamp responded HTTP $HTTP_CODE" - 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::" + # Check installed plugins and version match + PLUGIN_JSON=$(curl -sf --connect-timeout 10 "$HEADLAMP_URL/plugins" 2>/dev/null || echo "[]") + node -e " + const expected = '$EXPECTED'; + const pluginName = '$PLUGIN_NAME'; + const plugins = JSON.parse(process.argv[1]); + console.log('Installed plugins:'); + for (const p of plugins) console.log(' ' + p.name + '@' + (p.version||'unknown')); + const ours = plugins.find(p => p.name === pluginName || p.name === 'polaris' || p.name.includes('polaris')); + if (!ours) { + console.log('::warning::Plugin ' + pluginName + ' not found in Headlamp — data-dependent tests will fail'); + } else { + console.log('Found plugin: ' + ours.name + ' at path ' + ours.path); + } + " "$PLUGIN_JSON" + + # Fetch deployed plugin version from package.json + DEPLOYED_VERSION=$(curl -sf --connect-timeout 10 "$HEADLAMP_URL/plugins/$PLUGIN_NAME/package.json" 2>/dev/null \ + | node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).version" 2>/dev/null || echo "unknown") + echo "Deployed version: $DEPLOYED_VERSION" + if [ "$DEPLOYED_VERSION" != "$EXPECTED" ] && [ "$DEPLOYED_VERSION" != "unknown" ]; then + echo "::warning::Version mismatch — repo has $EXPECTED but Headlamp runs $DEPLOYED_VERSION. Tests may fail due to stale plugin." + fi - name: Install Playwright browsers run: npx playwright install --with-deps chromium