This commit is contained in:
@@ -50,7 +50,6 @@ def shell_budgets(label):
|
||||
source = f'. "$DECIDE_SH"; . "$CONTROLLER_SH"; . "$HCLOUD_SH"; '
|
||||
ttl = int(dash(source + f'gcr_label_ttl "{label}"'))
|
||||
profile = dash(source + f'gcr_label_profile "{label}"')
|
||||
grace = int(dash(source + 'gcr_ttl_grace_sec')) // 60
|
||||
script = source + f'gcr_bootstrap_script "{label}" token {ttl} runner'
|
||||
rendered = dash(script)
|
||||
match = re.search(r"runner:\n(?: .*\n)* timeout: (\d+)m\n", rendered)
|
||||
@@ -62,7 +61,7 @@ def shell_budgets(label):
|
||||
"gross-nix-x86 gross-nix-arm gross-nix-mixed-econ"
|
||||
others = dash(source + f"for l in {labels}; do "
|
||||
"printf '%s=%s\\n' \"$l\" \"$(gcr_label_ttl \"$l\")\"; done")
|
||||
return ttl, profile, grace, int(match.group(1)), others.splitlines()
|
||||
return ttl, profile, int(match.group(1)), others.splitlines()
|
||||
|
||||
|
||||
budget = workflow_budget(os.environ["WORKFLOW_FILE"])
|
||||
@@ -72,17 +71,17 @@ need(budget["runner_input"]["options"] == ["nix", "gross-nix-x86-perf", "gross-n
|
||||
need(budget["build"] > 0 and budget["drain"] > 0 and budget["upload"] > 0, "non-positive timeout")
|
||||
need(budget["build"] + budget["drain"] + 15 <= budget["workflow"], "workflow too short for build+drain")
|
||||
|
||||
ttl, profile, grace, runner_timeout, other_ttls = shell_budgets("gross-nix-x86-perf")
|
||||
ttl, profile, runner_timeout, other_ttls = shell_budgets("gross-nix-x86-perf")
|
||||
need(ttl == 480, f"expected 480m ttl, got {ttl}")
|
||||
need(profile.split()[1] == "480", f"profile ttl drifted: {profile}")
|
||||
need(all(line.endswith("=180") for line in other_ttls), f"default ttl drift: {other_ttls}")
|
||||
need(budget["workflow"] < runner_timeout, "workflow must be below runner timeout")
|
||||
need(minutes(os.environ["GITEA_WATCHDOG"]) >= budget["workflow"], "Gitea watchdog too short")
|
||||
need(ttl + grace >= budget["workflow"] + 15, "VM ttl lacks bootstrap allowance")
|
||||
need(ttl >= budget["workflow"] + 15, "VM ttl lacks bootstrap allowance")
|
||||
|
||||
highmem_ttl, highmem_profile, _, highmem_runner_timeout, _ = shell_budgets("gross-nix-x86-highmem")
|
||||
highmem_ttl, highmem_profile, highmem_runner_timeout, _ = shell_budgets("gross-nix-x86-highmem")
|
||||
need(highmem_ttl == 480, f"expected highmem 480m ttl, got {highmem_ttl}")
|
||||
need(highmem_profile == "ccx53 480 0.8550", f"highmem profile drifted: {highmem_profile}")
|
||||
need(highmem_runner_timeout == 480, f"highmem runner timeout drifted: {highmem_runner_timeout}")
|
||||
|
||||
print(f"PASS build={budget['build']}m drain={budget['drain']}m upload={budget['upload']}m workflow={budget['workflow']}m runner={runner_timeout}m ttl={ttl}m grace={grace}m watchdog={os.environ['GITEA_WATCHDOG']}")
|
||||
print(f"PASS build={budget['build']}m drain={budget['drain']}m upload={budget['upload']}m workflow={budget['workflow']}m runner={runner_timeout}m ttl={ttl}m watchdog={os.environ['GITEA_WATCHDOG']}")
|
||||
|
||||
Reference in New Issue
Block a user