Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ test:
./tests/host/network_monitor_test.sh
python3 -m unittest tests/test_network_portal.py
python3 -m unittest tests/test_imager_app.py
python3 -m unittest tests/test_manifest_metadata.py
python3 -m py_compile host/imager_app.py device/network/network_portal.py
@for file in $$(find host device site -type f \( -name '*.sh' -o -name cdmx-network \)); do bash -n "$$file"; done

Expand Down
8 changes: 5 additions & 3 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ image/cdmx-workshop-golden.img.xz
image/cdmx-workshop-golden.img.xz.sha512
```

Before publishing, update `version`, sizes, SHA-512, and `docker` in
`site/manifest.json`. The public site and both helpers consume that same file,
so every operator flashes exactly the same version.
Before publishing, update `version`, sizes, SHA-512, `docker`, and the immutable
`simulator` commits in `site/manifest.json`. The public site, both helpers, and
the [workshop simulator](https://radxa-simulator.mantilla.ca) consume that same
file, so they all use exactly the same version. Lepton checks the manifest every
five minutes and refreshes the simulator when that fingerprint changes.

## Docker and publication

Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,12 @@ image/cdmx-workshop-golden.img.xz
image/cdmx-workshop-golden.img.xz.sha512
```

Antes de publicar, actualice `version`, tamaños, SHA‑512 y `docker` en
`site/manifest.json`. El mismo archivo alimenta la web pública y ambos
ayudantes, de modo que todos graban exactamente la misma versión.
Antes de publicar, actualice `version`, tamaños, SHA‑512, `docker` y los commits
inmutables de `simulator` en `site/manifest.json`. El mismo archivo alimenta la
web pública, ambos ayudantes y
[el simulador del taller](https://radxa-simulator.mantilla.ca), de modo que
todos usan exactamente la misma versión. Lepton consulta el manifiesto cada
cinco minutos y actualiza el simulador cuando cambia ese fingerprint.

## Docker y publicación

Expand Down
6 changes: 6 additions & 0 deletions site/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
"compressed_bytes": 1908043732,
"uncompressed_bytes": 8074662912
},
"simulator": {
"url": "https://radxa-simulator.mantilla.ca",
"source_commit": "c75070da318021b0889c00924c824dfeba4a306e",
"bayesopt_source": "https://github.com/the-matter-lab/cdmx-bayesopt",
"bayesopt_commit": "2932febb16af89a465d4e7903d4eb0268489c045"
},
"launchers": {
"macos_terminal": "https://cdmx-radxaflash.mantilla.ca/start-macos.sh",
"windows_powershell": "https://cdmx-radxaflash.mantilla.ca/start-windows.ps1",
Expand Down
35 changes: 35 additions & 0 deletions tests/test_manifest_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import json
import re
import unittest
from pathlib import Path


ROOT = Path(__file__).parents[1]


class ManifestMetadataTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.manifest = json.loads((ROOT / "site" / "manifest.json").read_text())

def test_simulator_uses_production_https_url(self):
self.assertEqual(
self.manifest["simulator"]["url"],
"https://radxa-simulator.mantilla.ca",
)

def test_simulator_sources_are_immutable_commits(self):
simulator = self.manifest["simulator"]
self.assertRegex(simulator["source_commit"], r"^[0-9a-f]{40}$")
self.assertRegex(simulator["bayesopt_commit"], r"^[0-9a-f]{40}$")
self.assertRegex(
simulator["bayesopt_source"],
r"^https://github\.com/[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
)

def test_manifest_image_checksum_is_immutable(self):
self.assertTrue(re.fullmatch(r"[0-9a-f]{128}", self.manifest["image"]["sha512"]))


if __name__ == "__main__":
unittest.main()
Loading