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.

Fix preview frontend parity asset detection

rcourtmanc9cd8cf14bde
diff --git a/.github/workflows/deploy-demo-server.yml b/.github/workflows/deploy-demo-server.yml
index 834a050b4e..81c34b74df 100644
--- a/.github/workflows/deploy-demo-server.yml
+++ b/.github/workflows/deploy-demo-server.yml
@@ -270,15 +270,22 @@ jobs:
-o UserKnownHostsFile=~/.ssh/known_hosts
)
+ extract_entry_asset() {
+ python3 -c 'import re, sys; html = sys.stdin.read(); match = re.search(r"/assets/index-[^\" ]*\\.js", html); sys.exit(1) if match is None else sys.stdout.write(match.group(0))'
+ }
+
EXPECTED_ASSET="${{ steps.frontend.outputs.entry_asset }}"
- REMOTE_ASSET="$(
+ if ! REMOTE_ASSET="$(
ssh "${SSH_OPTS[@]}" "${DEPLOY_USER}@${DEPLOY_HOST}" \
- "curl -fsS ${DEMO_LOCAL_BASE_URL}/ | grep -o '/assets/index-[^\\\" ]*\\\\.js' | head -n 1"
- )"
- PUBLIC_ASSET="$(curl -fsS "$PUBLIC_ROOT_URL" | grep -o '/assets/index-[^\" ]*\.js' | head -n 1)"
-
- [ -n "$REMOTE_ASSET" ] || { echo "::error::Failed to resolve the remote frontend entry asset."; exit 1; }
- [ -n "$PUBLIC_ASSET" ] || { echo "::error::Failed to resolve the public frontend entry asset."; exit 1; }
+ "curl -fsS ${DEMO_LOCAL_BASE_URL}/" | extract_entry_asset
+ )"; then
+ echo "::error::Failed to resolve the remote frontend entry asset."
+ exit 1
+ fi
+ if ! PUBLIC_ASSET="$(curl -fsS "$PUBLIC_ROOT_URL" | extract_entry_asset)"; then
+ echo "::error::Failed to resolve the public frontend entry asset."
+ exit 1
+ fi
[ "$REMOTE_ASSET" = "$EXPECTED_ASSET" ] || {
echo "::error::Remote service is serving $REMOTE_ASSET but the build expected $EXPECTED_ASSET."
exit 1
diff --git a/.github/workflows/update-demo-server.yml b/.github/workflows/update-demo-server.yml
index 1fc8dbdd16..f3f79d24a4 100644
--- a/.github/workflows/update-demo-server.yml
+++ b/.github/workflows/update-demo-server.yml
@@ -375,14 +375,21 @@ jobs:
;;
esac
- REMOTE_ASSET="$(
- ssh -i ~/.ssh/id_ed25519 "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" \
- "curl -fsS ${DEMO_LOCAL_BASE_URL}/ | grep -o '/assets/index-[^\\\" ]*\\\\.js' | head -n 1"
- )"
- PUBLIC_ASSET="$(curl -fsS "$PUBLIC_ROOT_URL" | grep -o '/assets/index-[^\" ]*\.js' | head -n 1)"
+ extract_entry_asset() {
+ python3 -c 'import re, sys; html = sys.stdin.read(); match = re.search(r"/assets/index-[^\" ]*\\.js", html); sys.exit(1) if match is None else sys.stdout.write(match.group(0))'
+ }
- [ -n "$REMOTE_ASSET" ] || { echo "::error::Failed to resolve the remote frontend entry asset."; exit 1; }
- [ -n "$PUBLIC_ASSET" ] || { echo "::error::Failed to resolve the public frontend entry asset."; exit 1; }
+ if ! REMOTE_ASSET="$(
+ ssh -i ~/.ssh/id_ed25519 "$DEMO_SERVER_USER@$DEMO_SERVER_HOST" \
+ "curl -fsS ${DEMO_LOCAL_BASE_URL}/" | extract_entry_asset
+ )"; then
+ echo "::error::Failed to resolve the remote frontend entry asset."
+ exit 1
+ fi
+ if ! PUBLIC_ASSET="$(curl -fsS "$PUBLIC_ROOT_URL" | extract_entry_asset)"; then
+ echo "::error::Failed to resolve the public frontend entry asset."
+ exit 1
+ fi
[ "$PUBLIC_ASSET" = "$REMOTE_ASSET" ] || {
echo "::error::Public demo is serving $PUBLIC_ASSET but the target service is serving $REMOTE_ASSET."
exit 1
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index e1316d0986..69214ab771 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -185,7 +185,9 @@ dedicated preview service identity instead of defaulting back to the stable
`pulse` instance, and demo deploy/update verification must prove that the
public demo HTML serves the same frontend entry asset as the target service or
freshly built preview artifact rather than treating a passing `/api/health`
-response as enough evidence that the public shell actually updated.
+response as enough evidence that the public shell actually updated. That proof
+must use a deterministic HTML asset parser rather than brittle escaped shell
+regex that can fail differently over SSH than it does on the local runner.
Those same governed release workflows also own the operator-facing wording for
that promotion metadata. Human-visible workflow inputs, summaries, and error
messages must describe the path as a prerelease or preview flow rather than
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 81377b9716..9e668a87d4 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -123,6 +123,7 @@ func TestDeployDemoWorkflowFailsClosedForPreviewAndVerifiesFrontendParity(t *tes
`SERVICE_NAME="pulse-v6-preview"`,
`Preview demo deployments must not target the stable pulse service.`,
`Verify frontend parity`,
+ `extract_entry_asset()`,
`Remote service is serving $REMOTE_ASSET but the build expected $EXPECTED_ASSET.`,
`Public demo is serving $PUBLIC_ASSET but the build expected $EXPECTED_ASSET.`,
}
diff --git a/scripts/release_control/release_promotion_policy_test.py b/scripts/release_control/release_promotion_policy_test.py
index 1243a85f4d..b082510d68 100644
--- a/scripts/release_control/release_promotion_policy_test.py
+++ b/scripts/release_control/release_promotion_policy_test.py
@@ -232,10 +232,12 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn('SERVICE_NAME="pulse-v6-preview"', demo)
self.assertIn("Preview demo updates must not target the stable pulse service.", demo)
self.assertIn("Verify frontend parity", demo)
+ self.assertIn("extract_entry_asset()", demo)
self.assertIn("Public demo is serving $PUBLIC_ASSET but the target service is serving $REMOTE_ASSET.", demo)
self.assertIn('SERVICE_NAME="pulse-v6-preview"', preview_deploy)
self.assertIn("Preview demo deployments must not target the stable pulse service.", preview_deploy)
self.assertIn("Verify frontend parity", preview_deploy)
+ self.assertIn("extract_entry_asset()", preview_deploy)
self.assertIn("Public demo is serving $PUBLIC_ASSET but the build expected $EXPECTED_ASSET.", preview_deploy)
self.assertIn("control_plane.py --branch-for-version", helm)
self.assertIn("control_plane.py --branch-for-version", helm_pages)