Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

chore(web): take CI/CD from main, drop the standalone harness-web image

Dev jacobdde3a1f23107
diff --git a/desktop/README.md b/desktop/README.md
index 50eb1460f..1e28a26a7 100644
--- a/desktop/README.md
+++ b/desktop/README.md
@@ -76,26 +76,6 @@ For a local production build, run `bash scripts/build-web-release.sh X.Y.Z`.
`FLUTTER_BIN` can select an SDK installed outside `PATH`. Output is under
`build/web-release/` and `build/web-dist/`; the ordinary local preview is separate.
-### Web image
-
-[`deploy/web/`](deploy/web/) is a standalone image of the app alone: nginx serving
-only the app's routes (`/`, `/s/:id`, `/auth/callback`, `/callback`,
-`/harness-web/*`) on port 8080, with `/healthz`. **Release web does not build or
-push it**; production serves the app from the website image above. It remains for
-checking a published release in isolation: `prepare.py` verifies the checksum and
-applies the versioned asset layout, and `smoke.sh` fails if `/` is not that
-release's Flutter app.
-
-```bash
-gh release download vX.Y.Z_web -D rel -p 'harness-web-*.tar.gz' -p harness-web-release.json
-python3 deploy/web/prepare.py rel/harness-web-release.json rel/harness-web-X.Y.Z.tar.gz ctx
-docker build -f deploy/web/Dockerfile -t harness-web ctx
-docker run -d -p 8080:8080 harness-web && bash deploy/web/smoke.sh http://127.0.0.1:8080 rel/harness-web-release.json
-```
-
-Keep Docker files out of `web/`: `flutter build web` copies that folder into the
-public bundle.
-
### Browser behavior
- Authenticated access to existing machines uses the shared viewer services and
diff --git a/desktop/deploy/web/Dockerfile b/desktop/deploy/web/Dockerfile
deleted file mode 100644
index a81b4400a..000000000
--- a/desktop/deploy/web/Dockerfile
+++ /dev/null
@@ -1,13 +0,0 @@
-# harness.autonomous.ai's browser app as static files, for the existing ArgoCD rollout.
-#
-# The build context is the directory prepare.py writes — site/ and nginx.conf — not this repo:
-# python3 desktop/deploy/web/prepare.py harness-web-release.json harness-web-X.Y.Z.tar.gz ctx
-# docker build -f desktop/deploy/web/Dockerfile -t harness-web ctx
-# so the image serves the exact, checksum-verified bytes of the GitHub release. Non-root, port 8080.
-FROM nginxinc/nginx-unprivileged:1.27-alpine@sha256:65e3e85dbaed8ba248841d9d58a899b6197106c23cb0ff1a132b7bfe0547e4c0
-
-COPY nginx.conf /etc/nginx/conf.d/default.conf
-COPY site/ /usr/share/nginx/html/
-
-EXPOSE 8080
-HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://127.0.0.1:8080/healthz || exit 1
diff --git a/desktop/deploy/web/nginx.conf b/desktop/deploy/web/nginx.conf
deleted file mode 100644
index 7012a0021..000000000
--- a/desktop/deploy/web/nginx.conf
+++ /dev/null
@@ -1,46 +0,0 @@
-# harness.autonomous.ai's browser app: the app's routes and nothing else. The website keeps downloads,
-# /pair, /install.sh and its redirects; the ingress sends only these paths here.
-#
-# Cache rules are the website's (next.config.js), which the CDN in front relies on:
-# - entry pages and release.json: no-store, so every load sees the current release;
-# - /harness-web/releases/<version>-<sha12>/: immutable, since that URL never changes content;
-# - unversioned /harness-web/ files, kept for tabs opened before a deployment: revalidate every time.
-
-map $uri $harness_cache {
- ~^/harness-web/releases/ "public, max-age=31536000, immutable";
- ~^/harness-web/(index\.html|release\.json)$ "no-store";
- ~^/harness-web/ "public, max-age=0, must-revalidate";
- default "no-store";
-}
-
-server {
- listen 8080;
- server_name _;
- root /usr/share/nginx/html;
- server_tokens off;
-
- # Server-level only: an add_header inside a location would drop all of these for it.
- add_header Cache-Control $harness_cache always;
- add_header Referrer-Policy no-referrer always;
- add_header X-Content-Type-Options nosniff always;
-
- location = /healthz {
- access_log off;
- default_type text/plain;
- return 200 "ok\n";
- }
-
- # `/`, a shared link `/s/<id>`, the OAuth return (`/auth/callback`, and `/callback` for loopback
- # previews) and `/harness-web` all open the app; the base href keeps the visible URL.
- location ~ ^/(s/[^/]+|auth/callback|callback|harness-web)?/?$ {
- rewrite ^ /harness-web/index.html last;
- }
-
- location /harness-web/ {
- try_files $uri =404;
- }
-
- location / {
- return 404;
- }
-}
diff --git a/desktop/deploy/web/prepare.py b/desktop/deploy/web/prepare.py
deleted file mode 100644
index d54440d68..000000000
--- a/desktop/deploy/web/prepare.py
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env python3
-"""Turn a published web bundle into the image's build context.
-
- python3 prepare.py <harness-web-release.json> <harness-web-X.Y.Z.tar.gz> <out-dir>
-
-Writes <out-dir>/site/harness-web/ and <out-dir>/nginx.conf. Ported from the website's
-fetch-harness-web.mjs + harness-web-assets.mjs, which prepared the same tree inside its image:
-
-- the archive must match the manifest's SHA-256, and its own release.json the manifest;
-- every file is also served from /harness-web/releases/<version>-<sha12>/, and index.html loads
- JavaScript, fonts and CanvasKit only from there, so an edge or browser cache holding an older
- release can never mix its assets into a newer page. The unversioned files stay for tabs opened
- before a deployment;
-- the generated service worker is not started: it could keep serving an older app on its own.
-"""
-import hashlib
-import json
-import re
-import shutil
-import sys
-import tarfile
-from pathlib import Path, PurePosixPath
-
-BASE_HREF = '/harness-web/'
-LOADER = re.compile(r'_flutter\.loader\.load\(\{[\s\S]*?\}\);\s*(?=</script>)')
-
-
-def fail(message: str) -> None:
- sys.exit(f'ERROR {message}')
-
-
-def release_asset_base(release: dict) -> str:
- return f"{BASE_HREF}releases/{release['version']}-{release['sha256'][:12]}/"
-
-
-def configure_release_assets(html: str, release: dict) -> str:
- if len(LOADER.findall(html)) != 1:
- fail('unexpected Flutter bootstrap; refusing to publish unversioned assets')
- base = release_asset_base(release)
- config = {'entrypointBaseUrl': base, 'assetBase': base, 'canvasKitBaseUrl': f'{base}canvaskit/'}
- # Compact separators: the page must read exactly as the website's JSON.stringify wrote it.
- return LOADER.sub(f"_flutter.loader.load({json.dumps({'config': config}, separators=(',', ':'))});\n", html)
-
-
-def main(manifest_path: str, archive_path: str, out_dir: str) -> None:
- release = json.loads(Path(manifest_path).read_text())
- if not (re.fullmatch(r'\d+\.\d+\.\d+', release.get('version', ''))
- and re.fullmatch(r'[a-f0-9]{40}', release.get('sourceCommit', ''))
- and re.fullmatch(r'[a-f0-9]{64}', release.get('sha256', ''))
- and release.get('baseHref') == BASE_HREF):
- fail(f'invalid web release manifest: {manifest_path}')
- if hashlib.sha256(Path(archive_path).read_bytes()).hexdigest() != release['sha256']:
- fail('web archive checksum mismatch')
-
- out = Path(out_dir)
- shutil.rmtree(out, ignore_errors=True)
- served = out / 'site' / BASE_HREF.strip('/')
- served.mkdir(parents=True)
- with tarfile.open(archive_path, 'r:gz') as bundle:
- for member in bundle.getmembers():
- name = PurePosixPath(member.name)
- if name.is_absolute() or '..' in name.parts or not (member.isfile() or member.isdir()):
- fail(f'web archive contains an unsafe entry: {member.name}')
- bundle.extractall(served, filter='data')
-
- metadata = json.loads((served / 'release.json').read_text())
- index = (served / 'index.html').read_text()
- if (metadata.get('version') != release['version'] or metadata.get('sourceCommit') != release['sourceCommit']
- or metadata.get('baseHref') != BASE_HREF or f'<base href="{BASE_HREF}">' not in index):
- fail('web archive does not match its release manifest')
-
- entry = configure_release_assets(index, release)
- versioned = served / release_asset_base(release)[len(BASE_HREF):]
- shutil.copytree(served, versioned, ignore=shutil.ignore_patterns('releases'))
- (served / 'index.html').write_text(entry)
- shutil.copy(Path(__file__).with_name('nginx.conf'), out / 'nginx.conf')
- print(f"Prepared Harness web {release['version']} ({release['sourceCommit'][:12]}) in {out}")
-
-
-if __name__ == '__main__':
- if len(sys.argv) != 4:
- fail('usage: prepare.py <harness-web-release.json> <archive.tar.gz> <out-dir>')
- main(*sys.argv[1:])
diff --git a/desktop/deploy/web/smoke.sh b/desktop/deploy/web/smoke.sh
deleted file mode 100644
index 66f75d593..000000000
--- a/desktop/deploy/web/smoke.sh
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env bash
-# Smoke-test a running web image against its release manifest — the website's check-harness-web.mjs,
-# plus the check that would have stopped v1.2.22_web: `/` must be the Flutter app, not some other page.
-#
-# bash smoke.sh http://127.0.0.1:8080 harness-web-release.json
-# No -e: every check runs and reports, and the exit status says whether any failed.
-set -uo pipefail
-
-BASE="${1:?usage: smoke.sh <base-url> <harness-web-release.json>}"
-MANIFEST="${2:?usage: smoke.sh <base-url> <harness-web-release.json>}"
-VERSION="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["version"])' "$MANIFEST")"
-SHA12="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["sha256"][:12])' "$MANIFEST")"
-ASSET_BASE="/harness-web/releases/$VERSION-$SHA12/"
-FAILED=0
-
-check() { # <description> <condition-exit-code>
- if [ "$2" -eq 0 ]; then echo " ok $1"; else echo " FAIL $1"; FAILED=1; fi
-}
-
-for _ in $(seq 1 30); do curl -fs "$BASE/healthz" >/dev/null && break; sleep 1; done
-
-for route in / /s/11111111-1111-4111-8111-111111111111 '/auth/callback?code=fixture-code&state=fixture-state' /callback /harness-web; do
- headers="$(curl -s -D - -o /tmp/harness-web-smoke.html "$BASE$route")"
- html="$(cat /tmp/harness-web-smoke.html)"
- grep -q '^HTTP/[0-9.]* 200' <<<"$headers"; check "$route → 200" $?
- grep -qi '^content-type: text/html' <<<"$headers"; check "$route is HTML" $?
- grep -qi '^cache-control: no-store' <<<"$headers"; check "$route is no-store" $?
- grep -qi '^referrer-policy: no-referrer' <<<"$headers"; check "$route sends no referrer" $?
- grep -q '<base href="/harness-web/">' <<<"$html"; check "$route is the Flutter app" $?
- grep -qF "\"entrypointBaseUrl\":\"$ASSET_BASE\"" <<<"$html"; check "$route loads $ASSET_BASE" $?
- ! grep -q 'fixture-code' <<<"$html"; check "$route does not echo the callback code" $?
-done
-
-for spec in 'main.dart.js|javascript' 'assets/FontManifest.json|json' 'canvaskit/chromium/canvaskit.wasm|application/wasm'; do
- path="${spec%%|*}"; type="${spec#*|}"
- headers="$(curl -s -I "$BASE$ASSET_BASE$path")"
- grep -q '^HTTP/[0-9.]* 200' <<<"$headers"; check "$path → 200" $?
- grep -qi "^content-type: .*$type" <<<"$headers"; check "$path is $type" $?
- grep -qi '^cache-control: .*immutable' <<<"$headers"; check "$path is immutable" $?
-done
-
-curl -s "$BASE/harness-web/release.json" | grep -q "\"version\": \"$VERSION\""; check "release.json reports $VERSION" $?
-[ "$(curl -s -o /dev/null -w '%{http_code}' "$BASE/download")" = 404 ]; check "website routes are not served here" $?
-
-rm -f /tmp/harness-web-smoke.html
-[ "$FAILED" -eq 0 ] || { echo "smoke test FAILED"; exit 1; }
-echo "smoke test passed: Harness web $VERSION"