- fix_dup_volumes.py: 4 canonical templates had TWO volumes: keys inside one service (invalid YAML -> 'mapping key volumes already defined'), which broke every enable for anti-alchemy/burvesigner/gemas-notes/kode-viewer. - fjb: ghcr.io base is not anonymously pullable on this host; swapped to the official httpd:2.4 (its httpd.conf only uses stock modules). Added onlyBuiltDependencies to package.json (pnpm >=10 blocks esbuild's postinstall). - xl + kode-viewer: node:20-slim-bookworm is not a real tag; use node:20-bookworm-slim. gift-voucher: buster -> bookworm. - prebuild_images.py: build each challenge's shared services-<name> image once in parallel (passes a placeholder PASSWORD build-arg, since several Dockerfiles run chpasswd and fail on an empty arg). - set_enabled.py / sync_all_challenges.py: batch registry flip + runtime apply that survives panel restarts and reports per-team results. - Challenge toggle is now async: PATCH returns a job id, the client polls /api/challenges/jobs/<id> so a multi-minute build no longer blocks the panel. Added _SYNC_LOCK to serialize concurrent compose rewrites.
38 lines
1.2 KiB
Python
38 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Set the registry's enabled flags to exactly the given challenge names.
|
|
|
|
`set_challenge_enabled` only reports a change when the flag actually differs,
|
|
so flipping several challenges at once through the API is a long round trip.
|
|
This writes the registry directly (the same file the API writes) and leaves
|
|
runtime reconciliation to panel/sync_all_challenges.py.
|
|
|
|
Usage:
|
|
python3 panel/set_enabled.py gift-card art fjb
|
|
python3 panel/set_enabled.py --clear
|
|
"""
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
REG = Path("/opt/gemastik18-final/teams/challenge_registry.json")
|
|
|
|
|
|
def main(argv):
|
|
reg = json.loads(REG.read_text())
|
|
names = [c["name"] for c in reg["challenges"]]
|
|
want = set(argv[1:]) if "--clear" not in argv else set()
|
|
unknown = want - set(names)
|
|
if unknown:
|
|
print("unknown challenge(s):", ", ".join(sorted(unknown)))
|
|
return 2
|
|
for c in reg["challenges"]:
|
|
c["enabled"] = c["name"] in want
|
|
REG.write_text(json.dumps(reg, indent=2) + "\n")
|
|
enabled = [c["name"] for c in reg["challenges"] if c["enabled"]]
|
|
print(f"registry now enables {len(enabled)}: {', '.join(enabled)}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main(sys.argv))
|