Add Synology CPU shares CI profile and host capability preflight

This commit is contained in:
Codex
2026-09-29 14:52:31 +03:00
parent aa84e73bd8
commit 3321046c2a
8 changed files with 306 additions and 32 deletions
+14 -6
View File
@@ -15,12 +15,20 @@ ROOT = Path(__file__).resolve().parents[2]
SOURCE = Path(__file__).resolve().parent
ENTRIES = ("docker-compose.gitea-ci.yml", "runner.yaml", "deployment/bootstrap-v1.json")
V2_ENTRIES = ("docker-compose.gitea-ci.yml", "runner.yaml", "deployment/bootstrap-v2.json")
V3_ENTRIES = ("docker-compose.gitea-ci.yml", "runner.yaml", "deployment/bootstrap-v3.json")
def entries_for(patch_id):
if not re.fullmatch(r"gitea-ci-bootstrap-v[123]-[a-zA-Z0-9._-]{1,65}", patch_id):
raise ValueError("invalid_bootstrap_identity")
if patch_id.startswith("gitea-ci-bootstrap-v3-"):
return V3_ENTRIES
return V2_ENTRIES if patch_id.startswith("gitea-ci-bootstrap-v2-") else ENTRIES
def bundle(patch_id, source=SOURCE):
if not re.fullmatch(r"gitea-ci-bootstrap-v[12]-[a-zA-Z0-9._-]{1,65}", patch_id):
raise ValueError("invalid_bootstrap_identity")
entries = V2_ENTRIES if patch_id.startswith("gitea-ci-bootstrap-v2-") else ENTRIES
entries = entries_for(patch_id)
config_source = source / "synology-v3" if entries == V3_ENTRIES else source
descriptor = json.loads((source / Path(entries[2]).name).read_text())
if descriptor["releaseId"] != "__PATCH_ID__":
raise ValueError("bootstrap_template_identity_mismatch")
@@ -28,8 +36,8 @@ def bundle(patch_id, source=SOURCE):
files = {
"manifest.env": ("id=" + patch_id + "\ncomponent=gitea-ci\ntype=app-overlay\n").encode(),
"files.txt": ("\n".join(entries) + "\n").encode(),
"payload/docker-compose.gitea-ci.yml": (source / ENTRIES[0]).read_bytes(),
"payload/runner.yaml": (source / ENTRIES[1]).read_bytes(),
"payload/docker-compose.gitea-ci.yml": (config_source / ENTRIES[0]).read_bytes(),
"payload/runner.yaml": (config_source / ENTRIES[1]).read_bytes(),
"payload/" + entries[2]: (json.dumps(descriptor, indent=2) + "\n").encode(),
}
result = io.BytesIO()
@@ -65,7 +73,7 @@ def main():
"artifact": str(path.resolve()), "patchId": args.patch_id,
"component": "gitea-ci", "sourceCommit": actual,
"sha256": hashlib.sha256(data).hexdigest(),
"entries": V2_ENTRIES if args.patch_id.startswith("gitea-ci-bootstrap-v2-") else ENTRIES,
"entries": entries_for(args.patch_id),
"services": ["build-runner"], "publishedPorts": [],
"productionDeployEnabled": False,
}))