Merge branch 'catalog-contra' into main
4 files changed,
+46
−9
README.md+19 −0internal/catalog/catalog.json+8 −0internal/catalog/catalog_test.go+4 −0scripts/prepare-apps_test.sh+15 −9
CI passed — run details
CI log
=== build === CGO_ENABLED=0 go build ./... === vet === go vet ./... === fmt-check === === staticcheck === go run honnef.co/go/tools/cmd/staticcheck@v0.7.0 ./... === govulncheck === go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./... No vulnerabilities found. === gitleaks === [90m3:56PM[0m [32mINF[0m [1mUnknown SCM platform. Use --platform to include links in findings.[0m [36mhost=[0mamadan.net [90m3:56PM[0m [32mINF[0m [1m1 commits scanned.[0m [90m3:56PM[0m [32mINF[0m [1mscanned ~2494063 bytes (2.49 MB) in 308ms[0m [90m3:56PM[0m [32mINF[0m [1mno leaks found[0m === budget === go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget size budget size: 22 directories within budget === script-test === scripts/prepare-apps_test.sh ok releases lookup failure stops before ship ok app owned elsewhere stops the script ok apps listing failure stops before create ok ambiguous release dir is refused ok explicit version resolves the ambiguity ok releases match is exact, not substring ok shipped version is only promoted, existing app not created ok fresh account creates, ships, promotes to edge, enables ok failing promote stops the script ok ship is retried while uploads are rate limited all passed hack/fonts_test.sh fonts_test: ok === test === go run amadan.net/rastrillo/rastrillo/cmd/rastrillo budget test -count=1 ./... receipt: test step 7.431s against a 60s target (the gate's other steps are not in this figure) receipt: 16 packages ran, 0 cached, 6 without tests, 0 failed receipt: slow package 6.317s amadan.net/oficina/base/internal/webtest receipt: slow package 605ms amadan.net/oficina/base/internal/operations receipt: slow package 451ms amadan.net/oficina/base/internal/issuer receipt: slow package 233ms amadan.net/oficina/base/internal/consumer receipt: slow package 167ms amadan.net/oficina/base/internal/web receipt: slow test 1.51s amadan.net/oficina/base/internal/webtest TestHomeDoesNotWaitOnAStalledSnapshot receipt: slow test 1.08s amadan.net/oficina/base/internal/webtest TestAskZoneIsToldOnce receipt: slow test 520ms amadan.net/oficina/base/internal/operations TestOperationsRefusals receipt: slow test 250ms amadan.net/oficina/base/internal/issuer TestAuthorizeRefusals receipt: slow test 220ms amadan.net/oficina/base/internal/webtest TestAskZoneAgainOnANewConnection === native === strings: copy review's strings.json is not here (git-ignored); its comparison skipped strings: 119 in the catalog, 116 used worktree-lib_test: ok
diff --git a/README.md b/README.md| index edbf992..c048da6 100644 |
| --- a/README.md |
| +++ b/README.md |
| @@ -163,6 +163,25 @@ fails halfway; steps already done are skipped. It stops if the account |
| doesn't list an app but the name can't be claimed, because someone else owns it. You need to be logged in with |
| `carlos auth login` first. |
| +Not every catalogue app is built here. Contra's binary comes from its own |
| +repository (`carlos/contra`), and it must be shipped with mail submission on, |
| +which this script doesn't do. So before running the script: |
| + |
| +1. Run `make release` in Contra. It writes `releases/contra-linux-arm64` and |
| + prints the version it stamped. |
| +2. Ship it yourself on Base's account (`BASE_PLATFORM_ACCOUNT`; `oficina` in |
| + production): `carlos ship --app contra --account <account> --mail submit |
| + --version <version> releases/contra-linux-arm64`. Claim the name first with |
| + `carlos apps create` if the account doesn't have `contra` yet. An app |
| + called `contra` on another account is a different app and doesn't matter. |
| +3. Copy the binary into Base's `releases/` as `contra-linux-arm64-<version>`, |
| + the same version. The script then finds it already shipped, promotes it to |
| + `edge` and enables instances. |
| + |
| +Contra's version is its own commit, not Base's, so keep one build of each app |
| +in `releases/` rather than passing a version: a version you pass must match |
| +every app's file name. |
| + |
| ## Writing an app Base can install |
| Base starts your app with four variables. Read them, and verify sign-ins |
diff --git a/internal/catalog/catalog.json b/internal/catalog/catalog.json| index 2900c15..a7f3ade 100644 |
| --- a/internal/catalog/catalog.json |
| +++ b/internal/catalog/catalog.json |
| @@ -14,5 +14,13 @@ |
| "tint": "rose", |
| "icon": "<svg viewBox=\"0 0 24 24\"><path d=\"M6 3h9l4 4v13a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z\"/><path d=\"M15 3v4h4M8.5 12h7M8.5 15.5h5\"/></svg>", |
| "default": false |
| + }, |
| + { |
| + "id": "contra", |
| + "name": "Contra", |
| + "summary": "Passwords only your own devices can open.", |
| + "tint": "teal", |
| + "icon": "<svg viewBox=\"0 0 24 24\"><rect x=\"4\" y=\"4\" width=\"16\" height=\"14\" rx=\"2\"/><circle cx=\"12\" cy=\"11\" r=\"3.5\"/><path d=\"M12 11V7.5M7.5 18v2M16.5 18v2\"/></svg>", |
| + "default": false |
| } |
| ] |
diff --git a/internal/catalog/catalog_test.go b/internal/catalog/catalog_test.go| index 9e7f8f5..fae2d9f 100644 |
| --- a/internal/catalog/catalog_test.go |
| +++ b/internal/catalog/catalog_test.go |
| @@ -30,6 +30,10 @@ func TestGet(t *testing.T) { |
| if !ok || s.Default || s.Tint != "rose" { |
| t.Fatalf("scratchpad: %+v %v", s, ok) |
| } |
| + c, ok := Get("contra") |
| + if !ok || c.Default || c.Tint != "teal" { |
| + t.Fatalf("contra: %+v %v", c, ok) |
| + } |
| if _, ok := Get("nope"); ok { |
| t.Fatal("unexpected") |
| } |
diff --git a/scripts/prepare-apps_test.sh b/scripts/prepare-apps_test.sh| index e3c6a38..2d35e30 100755 |
| --- a/scripts/prepare-apps_test.sh |
| +++ b/scripts/prepare-apps_test.sh |
| @@ -47,11 +47,18 @@ exit 0 |
| FAKE |
| chmod +x "$work/bin/carlos" |
| +# The catalogue's app ids, read the way the script reads them, so a new |
| +# catalogue entry (Contra's binary comes from another repo) needs no edit here. |
| +catalog_ids=$(grep -o '"id": *"[^"]*"' "$here/../internal/catalog/catalog.json" | sed 's/.*: *"\(.*\)"/\1/') |
| + |
| +# What `apps list` prints when the account already has every catalogue app. |
| +all_apps=$(for a in $catalog_ids; do echo "$a x"; done) |
| + |
| # newdir makes a release dir with one build of each catalogue app. |
| newdir() { |
| local d |
| d=$(mktemp -d "$work/rel.XXXXXX") |
| - for a in welcome scratchpad; do |
| + for a in $catalog_ids; do |
| : >"$d/$a-linux-arm64-aaa111" |
| : >"$d/$a-linux-arm64-aaa111.COMMIT" |
| done |
| @@ -82,7 +89,7 @@ export PREPARE_APPS_RETRY_SLEEP=0 |
| # Deploy creates a stray instance, so it must never be called, in any case below. |
| # A failed releases lookup must stop the script before it ships. |
| -FAKE_APPS=$'welcome x\nscratchpad x' FAKE_RELEASES_FAIL=1 \ |
| +FAKE_APPS="$all_apps" FAKE_RELEASES_FAIL=1 \ |
| check "releases lookup failure stops before ship" nonzero '^releases ' '^(deploy|ship|promote) ' -- acme "$d" |
| # An app that is not in this account's listing, and cannot be created, stops it. |
| @@ -95,21 +102,20 @@ FAKE_LIST_FAIL=1 \ |
| # Several builds of one app and no explicit version is ambiguous. |
| d2=$(newdir) |
| -: >"$d2/welcome-linux-arm64-bbb222" |
| -: >"$d2/scratchpad-linux-arm64-bbb222" |
| +for a in $catalog_ids; do : >"$d2/$a-linux-arm64-bbb222"; done |
| check "ambiguous release dir is refused" nonzero '' '^(apps|deploy|instances|releases) ' -- acme "$d2" |
| grep -qi 'version' "$work/out" || { echo "FAIL ambiguity message should mention version"; fails=$((fails + 1)); } |
| # An explicit version picks the right build out of several. |
| -FAKE_APPS=$'welcome x\nscratchpad x' \ |
| +FAKE_APPS="$all_apps" \ |
| check "explicit version resolves the ambiguity" zero 'ship .*--version bbb222 .*welcome-linux-arm64-bbb222' '^deploy ' -- acme "$d2" bbb222 |
| # Version match is exact: aaa111 listed as a prefix of the shipped version is not shipped. |
| -FAKE_APPS=$'welcome x\nscratchpad x' FAKE_RELEASES='aaa1112 - binary now -' \ |
| +FAKE_APPS="$all_apps" FAKE_RELEASES='aaa1112 - binary now -' \ |
| check "releases match is exact, not substring" zero '^ship ' '^deploy ' -- acme "$d" |
| # Already shipped: promote to edge, don't ship or deploy. Existing apps: no create. |
| -FAKE_APPS=$'welcome x\nscratchpad x' FAKE_RELEASES='aaa111 - binary now -' \ |
| +FAKE_APPS="$all_apps" FAKE_RELEASES='aaa111 - binary now -' \ |
| check "shipped version is only promoted, existing app not created" zero '^promote .* aaa111 edge$' '^(deploy|ship|apps create) ' -- acme "$d" |
| # Fresh account: create, ship, promote to edge, enable, and never deploy or touch stable. |
| @@ -118,12 +124,12 @@ grep -qE '^promote --app scratchpad --account acme --no-prompt aaa111 edge$' "$w |
| grep -qE '^instances enable --app scratchpad' "$work/calls" || { echo "FAIL instances should be enabled"; fails=$((fails + 1)); } |
| # A failing promote stops the script before instances are enabled. |
| -FAKE_APPS=$'welcome x\nscratchpad x' FAKE_PROMOTE_FAIL=1 \ |
| +FAKE_APPS="$all_apps" FAKE_PROMOTE_FAIL=1 \ |
| check "failing promote stops the script" nonzero '^promote ' '^(deploy|instances) ' -- acme "$d" |
| # "too many uploads" is retried until ship works. |
| rm -f "$work/calls.busy" |
| -FAKE_APPS=$'welcome x\nscratchpad x' FAKE_SHIP_BUSY=2 \ |
| +FAKE_APPS="$all_apps" FAKE_SHIP_BUSY=2 \ |
| check "ship is retried while uploads are rate limited" zero '^promote ' '^deploy ' -- acme "$d" |
| [ "$(grep -c '^ship .*welcome' "$work/calls")" -eq 3 ] || { echo "FAIL ship should be tried 3 times"; fails=$((fails + 1)); } |