Webhook icon
Schedule icon
Commands icon
Docker icon
If icon
SlackIncomingWebhook icon
Log icon

Hold Every Release to a Lighthouse Score Budget

Post-deploy Lighthouse audit that scores performance, accessibility, and best practices against your budgets and alerts Slack when any drops below.

Categories
DataInfrastructure

Deploys rarely break a site outright, they shave points. A new chat widget drops accessibility, a hero video drags performance, a third-party tag trashes best practices, and the dashboard nobody looks at records it all in silence. This blueprint makes the score a gate: Lighthouse runs against the URL you just deployed, the three category scores are compared with budgets you set, and any breach lands in Slack with the actual numbers beside the floors they broke. Passing runs log their scores too, so the execution history is your score trend release over release.

How it works

  1. run_lighthouse (io.kestra.plugin.scripts.shell.Commands on the Docker task runner) uses node:20-bookworm by default, installs Chromium and pinned lighthouse@12 (pin keeps scores comparable across runs), audits the URL headlessly with --no-sandbox --disable-dev-shm-usage for container friendliness, and emits performance, accessibility, and best_practices through the ::{"outputs": ...}:: protocol. Missing categories coerce to 0 so a crashed category can never compare as "passing". Point lighthouse_image at a prebaked image with Chromium and Lighthouse already installed to make runs fast.
  2. check_budget (io.kestra.plugin.core.flow.If) tests all three scores against their inputs in one condition. Any breach: alert_budget_breach posts each score next to its floor; all clear: log_within_budget records the scores for the trend.
  3. The errors block alerts Slack when the audit itself fails, no score must never read as a passing score.
  4. Triggers: a Webhook (perf-budget-check) for the deploy pipeline plus a disabled daily Schedule to catch third-party drift that arrives without a deploy.

What you get

  • A release gate on the three scores teams actually argue about: performance, accessibility, best practices.
  • Breach alerts that show measured score versus budget per category, the regression and its size in one message.
  • A score_summary JSON output for dashboards or a downstream approval step.
  • Score history in the execution log, one entry per release.

Who it's for

  • Web teams whose Core-Web-Vitals-style scores drift a few points with every marketing addition.
  • Agencies holding contracts that mention accessibility or performance targets.
  • Platform teams wiring quality checks into the same deploy pipeline that ships the code.

Why orchestrate this with Kestra

Lighthouse itself produces a report nobody opens; the flow turns it into a decision. Kestra adds the event entry point (post-deploy webhook), the budget branch, the alert, the self-reporting failure channel, and the history, and because the gate is a flow, the natural next step (block the deploy, open a ticket, compare with yesterday's scores) is one task away.

Prerequisites

  • The target URL reachable from the Kestra Worker.
  • Outbound package downloads on first run (apt + npm), or your own prebaked image in lighthouse_image.
  • A Slack incoming webhook for breach and failure alerts.

Secrets

  • SLACK_WEBHOOK_URL: Slack incoming webhook URL for budget and audit-failure alerts.

Quick start

  1. Add the Slack webhook secret to your namespace.
  2. Set url to your site and tighten the three budgets to your targets (defaults are deliberately lenient at 0.5 so the first run demonstrates the path).
  3. Run once and read score_summary, compare against a browser's Lighthouse panel if you like.
  4. Call the perf-budget-check webhook from your deploy pipeline.

How to extend

  • Fail the execution on breach (for a hard gate) by adding an io.kestra.plugin.core.execution.Fail task after the Slack alert in the then branch.
  • Add categories by extending --only-categories (SEO, PWA) and the budget condition.
  • Store score_summary in KV and alert only on drops relative to yesterday's score.
  • Audit several URLs by wrapping the flow as a subflow over a pages input.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.