Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Reuse real-embed backend proof in the smoke verdict

pulse-triage[bot]86ae68952e0c
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index 20661f3824..abf15b3a5c 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -1057,40 +1057,28 @@ jobs:
scripts-and-build:
name: Script smoke tests & backend build
- needs: [changes, script-smoke]
+ # The runtime job already compiles and vets this checkout with the verified
+ # production frontend. Require that stronger proof rather than starting
+ # another runner checkout/compiler/cache cycle to build a placeholder UI.
+ needs: [changes, script-smoke, frontend-checks]
if: always() && needs.changes.outputs.code == 'true'
runs-on: ubuntu-24.04
- timeout-minutes: 30
+ timeout-minutes: 5
steps:
- name: Require every script smoke shard
env:
SMOKE_RESULT: ${{ needs.script-smoke.result }}
+ BACKEND_RESULT: ${{ needs.frontend-checks.result }}
run: |
if [ "$SMOKE_RESULT" != success ]; then
echo "::error::Script smoke shards did not all pass (result: ${SMOKE_RESULT})"
exit 1
fi
- echo "Every script smoke shard passed."
-
- - name: Checkout repository
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- persist-credentials: false
-
- - name: Set up Go
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
- with:
- go-version-file: go.mod
- cache: true
-
- - name: Provide frontend embed stub
- run: |
- mkdir -p internal/api/frontend-modern/dist
- [ -f internal/api/frontend-modern/dist/index.html ] || \
- printf '<!doctype html><title>ci embed stub</title>\n' > internal/api/frontend-modern/dist/index.html
-
- - name: Build Pulse backend
- run: go build ./cmd/pulse
+ if [ "$BACKEND_RESULT" != success ]; then
+ echo "::error::This run's real-embed backend proof did not pass (result: ${BACKEND_RESULT})"
+ exit 1
+ fi
+ echo "Every script smoke shard and this run's real-embed backend proof passed."
chart-latency-slo:
name: Workload chart SLO evidence
diff --git a/scripts/tests/test_smoke_workflow.py b/scripts/tests/test_smoke_workflow.py
index 5ca23d0dd5..f5c563fdcb 100644
--- a/scripts/tests/test_smoke_workflow.py
+++ b/scripts/tests/test_smoke_workflow.py
@@ -14,6 +14,9 @@ import tempfile
import textwrap
import unittest
+import yaml
+
+from test_frontend_real_embed import recipe as real_embed_recipe
from test_public_docs_workflow import job_body, step_body, workflow_fixture_environment
@@ -71,33 +74,72 @@ class SmokeWorkflowTest(unittest.TestCase):
def test_existing_required_check_is_fail_closed(self):
build = job_body(self.source, "scripts-and-build")
- self.assertIn(" needs: [changes, script-smoke]\n", build)
+ self.assertIn(" needs: [changes, script-smoke, frontend-checks]\n", build)
self.assertIn(" if: always() && needs.changes.outputs.code == 'true'\n", build)
self.assertEqual(self.source.count(f" name: {REQUIRED_NAME}\n"), 1)
self.assertIn(" SMOKE_RESULT: ${{ needs.script-smoke.result }}\n", build)
- for state in ("success", "failure", "cancelled", "skipped", "", "unknown"):
- with self.subTest(state=state):
+ self.assertIn(" BACKEND_RESULT: ${{ needs.frontend-checks.result }}\n", build)
+ states = ("success", "failure", "cancelled", "skipped", "", "unknown")
+ for smoke_state in states:
+ for backend_state in states:
+ with self.subTest(smoke=smoke_state, backend=backend_state):
+ result = subprocess.run(
+ ["bash", "-e", "-u", "-o", "pipefail", "-c", verdict_command(self.source)],
+ env=dict(os.environ, SMOKE_RESULT=smoke_state, BACKEND_RESULT=backend_state),
+ text=True, capture_output=True, timeout=5,
+ )
+ self.assertEqual(result.returncode == 0,
+ smoke_state == backend_state == "success",
+ result.stdout + result.stderr)
+ if result.returncode == 0:
+ self.assertIn("this run's real-embed backend proof passed", result.stdout)
+
+ def test_missing_result_cannot_admit_the_required_check(self):
+ for missing in ("SMOKE_RESULT", "BACKEND_RESULT"):
+ with self.subTest(missing=missing):
+ env = dict(os.environ, SMOKE_RESULT="success", BACKEND_RESULT="success")
+ env.pop(missing)
result = subprocess.run(
- ["bash", "-e", "-o", "pipefail", "-c", verdict_command(self.source)],
- env=dict(os.environ, SMOKE_RESULT=state), text=True,
- capture_output=True, timeout=5,
+ ["bash", "-e", "-u", "-o", "pipefail", "-c", verdict_command(self.source)],
+ env=env, text=True, capture_output=True, timeout=5,
)
- self.assertEqual(result.returncode == 0, state == "success",
- result.stdout + result.stderr)
-
- def test_backend_build_waits_for_gate_and_is_still_required(self):
- build = job_body(self.source, "scripts-and-build")
- self.assertLess(build.index(VERDICT_STEP), build.index("Checkout repository"))
- self.assertLess(build.index(VERDICT_STEP), build.index("Build Pulse backend"))
- self.assertIn(" runs-on: ubuntu-24.04\n", build)
- self.assertIn(" timeout-minutes: 30\n", build)
- self.assertIn(" go-version-file: go.mod\n", build)
- self.assertIn(" persist-credentials: false\n", build)
- self.assertIn(" - name: Provide frontend embed stub\n", build)
- self.assertIn(" run: go build ./cmd/pulse\n",
- step_body(build, "Build Pulse backend"))
- self.assertEqual(re.findall(r"(?m)^\s*if:.*$", build),
- [" if: always() && needs.changes.outputs.code == 'true'"])
+ self.assertNotEqual(result.returncode, 0)
+
+ def test_verdict_reuses_required_same_run_real_embed_build_without_another_compiler(self):
+ jobs = yaml.safe_load(self.source)["jobs"]
+ verdict = jobs["scripts-and-build"]
+ self.assertEqual(verdict["runs-on"], "ubuntu-24.04")
+ self.assertEqual(verdict["timeout-minutes"], 5)
+ self.assertEqual(verdict["needs"], ["changes", "script-smoke", "frontend-checks"])
+ self.assertEqual(verdict["if"], "always() && needs.changes.outputs.code == 'true'")
+ self.assertNotIn("continue-on-error", verdict)
+ self.assertEqual(len(verdict["steps"]), 1)
+ step = verdict["steps"][0]
+ self.assertEqual(step["env"], {
+ "SMOKE_RESULT": "${{ needs.script-smoke.result }}",
+ "BACKEND_RESULT": "${{ needs.frontend-checks.result }}",
+ })
+ self.assertNotIn("if", step)
+ self.assertNotIn("continue-on-error", step)
+ self.assertNotIn("uses", step)
+ self.assertNotRegex(step["run"], r"\b(?:go|npm|git)\b")
+
+ # The reused producer is in this same workflow/DAG, not a cached status
+ # or an unrelated successful job. Check its actual production-asset
+ # transfer, declared compiler, readonly build/vet recipe and ordering.
+ real_embed_recipe(self.source)
+ backend = jobs["frontend-checks"]
+ self.assertEqual(backend["if"], "${{ !cancelled() && needs.changes.outputs.code == 'true' && needs.frontend-build.outputs.unit_admitted == 'true' }}")
+ self.assertNotIn("continue-on-error", backend)
+ required = {"Verify backend with real frontend embed",
+ "Check current-source unattended recovery on native systemd",
+ "Check ordinary notification policy and restart"}
+ found = {step["name"] for step in backend["steps"] if step["name"] in required}
+ self.assertEqual(found, required)
+ for step in backend["steps"]:
+ if step["name"] in required:
+ self.assertNotIn("if", step)
+ self.assertNotIn("continue-on-error", step)
def run_adapters(self, shard: int, failing: str = ""):
"""Run actual workflow/runner commands on every source-selected name.
@@ -164,7 +206,7 @@ class SmokeWorkflowTest(unittest.TestCase):
self.assertIn(f"Summary: {len(names)-1}/{len(names)} passed", result.stdout)
gate = subprocess.run(
["bash", "-e", "-o", "pipefail", "-c", verdict_command(self.source)],
- env=dict(os.environ, SMOKE_RESULT="failure"), text=True,
+ env=dict(os.environ, SMOKE_RESULT="failure", BACKEND_RESULT="success"), text=True,
capture_output=True, timeout=5,
)
self.assertNotEqual(gate.returncode, 0)