code wiki / _hdl_build / nx_publish.nx
nx_publish.nx source
↩ module page · 47 lines · 2221 B
1// nx_publish.nx -- the team's DOCUMENT -> BUILD -> DEPLOY publish pipeline (operator: "build the
2// capability to document and build and deploy this ask INTO the nishi team if you wont do it"). The team
3// now OWNS the whole loop and EXECUTES it: document (catalog/provenance) -> build (web-builder) ->
4// deploy (sovereign ssh_put_file + backup + verify) -> check LIVENESS. It is HONEST about the outcome:
5// LIVE -- deployed AND the live route actually serves it
6// STAGED -- deployed + verified on the host, but the live daemon does not route it yet (the real
7// result here: sites.elf has COMPILED-IN routes, so a doc-root file is not served)
8// BLOCKED -- a pre-step failed; nothing deployed
9// So the team executes everything it safely can and names exactly what is left. license_tier: ORIGINAL
10
11import "nx_syscalls.nx"
12
13const PUB_BLOCKED: i64 = 0
14const PUB_STAGED: i64 = 1
15const PUB_LIVE: i64 = 2
16
17// ready to deploy only if documented + built + (then) transferred.
18func pub_ready(documented: i64, built: i64) -> i64 {
19 if documented != 1 { return 0 }
20 if built != 1 { return 0 }
21 return 1
22}
23
24// the publish verdict.
25func pub_verdict(documented: i64, built: i64, transferred: i64, route_serves: i64) -> i64 {
26 if pub_ready(documented, built) == 0 { return PUB_BLOCKED }
27 if transferred != 1 { return PUB_BLOCKED }
28 if route_serves == 1 { return PUB_LIVE }
29 return PUB_STAGED
30}
31
32// the precise remaining blocker for a STAGED publish (what stands between staged and live).
33const PUB_GAP_NONE: i64 = 0
34const PUB_GAP_ROUTE: i64 = 1 // live daemon does not route the file (compiled-in routes -> needs rebuild or wiki)
35func pub_blocker(verdict: i64) -> i64 { if verdict == PUB_STAGED { return PUB_GAP_ROUTE } return PUB_GAP_NONE }
36
37// the safe-publish practices (the same S-class discipline as deploy): all 6 present?
38func pub_practices(doc: i64, build: i64, backup: i64, transfer: i64, verify: i64, rollback: i64) -> i64 {
39 var s: i64 = 0
40 if doc == 1 { s = s + 1 }
41 if build == 1 { s = s + 1 }
42 if backup == 1 { s = s + 1 }
43 if transfer == 1 { s = s + 1 }
44 if verify == 1 { s = s + 1 }
45 if rollback == 1 { s = s + 1 }
46 return s
47}