Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion pmoves/integrations/github-runners/compose/lane_hosts.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
{
"lane_hosts": {}
"lane_hosts": {
"self-hosted,Linux,X64": {
"host": "vps / ai-lab",
"runner_name": "pmoves-vps-runner",
"registration_script": "integrations/github-runners/compose/register-runner.sh"
},
"self-hosted,ai-lab,gpu": {
"host": "ai-lab",
"runner_name": "pmoves-ai-lab-runner",
"registration_script": "integrations/github-runners/compose/register-runner.sh"
},
"self-hosted,ai-lab": {
"host": "ai-lab",
"runner_name": "pmoves-ai-lab-runner",
"registration_script": "integrations/github-runners/compose/register-runner.sh"
},
"self-hosted,vps,Linux,X64": {
"host": "vps",
"runner_name": "pmoves-vps-runner",
"registration_script": "integrations/github-runners/compose/register-runner.sh"
},
"self-hosted,gpu": {
"host": "ai-lab",
"runner_name": "pmoves-ai-lab-runner",
"registration_script": "integrations/github-runners/compose/register-runner.sh"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"default_phase": "",
"phases": {}
"default_phase": "local-certification",
"phases": {
"local-certification": {
"description": "Both runners on local Docker containers for development/CI",
"required_online": ["self-hosted,Linux,X64", "self-hosted,ai-lab,gpu"],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require VPS lane explicitly in local-cert policy

This phase is described as "Both runners on local Docker containers", but required_online currently uses self-hosted,Linux,X64 plus self-hosted,ai-lab,gpu; because lane checks are subset-based in runner_lane_map.py, the ai-lab runner (self-hosted,ai-lab,gpu,Linux,X64) can satisfy both requirements by itself, so the policy can pass while the VPS runner is offline and fail to enforce the stated two-runner requirement.

Useful? React with 馃憤聽/ 馃憥.

"required_offline": [],
"min_runners": 2
}
}
}
83 changes: 59 additions & 24 deletions pmoves/tools/local_cert_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,31 +83,66 @@ def docker_rm(container_name: str) -> None:
run_cmd(["docker", "rm", "-f", container_name], check=False)


LOKI_URL = os.getenv("LOKI_URL", "http://localhost:3100/loki/api/v1/push")

# Default resource limits per lane (overridable via env)
LANE_RESOURCES: dict[str, dict[str, str]] = {
"ai-lab": {
"cpus": os.getenv("RUNNER_AI_LAB_CPUS", "4"),
"memory": os.getenv("RUNNER_AI_LAB_MEMORY", "8g"),
"gpus": "all",
},
"vps": {
"cpus": os.getenv("RUNNER_VPS_CPUS", "2"),
"memory": os.getenv("RUNNER_VPS_MEMORY", "4g"),
"gpus": "",
},
}


def docker_run(repo: str, image: str, lane: RunnerLane, token: str) -> None:
run_cmd(
[
"docker",
"run",
"-d",
"--name",
lane.container_name,
"--restart",
"unless-stopped",
"-e",
f"REPO_URL=https://github.com/{repo}",
"-e",
f"RUNNER_NAME={lane.runner_name}",
"-e",
f"RUNNER_TOKEN={token}",
"-e",
f"LABELS={lane.labels}",
"-e",
"RUNNER_WORKDIR=/tmp/runner/_work",
"-v",
"/var/run/docker.sock:/var/run/docker.sock",
image,
]
)
resources = LANE_RESOURCES.get(lane.lane, {"cpus": "4", "memory": "8g"})
cmd = [
"docker",
"run",
"-d",
"--name",
lane.container_name,
"--restart",
"unless-stopped",
"--cpus",
resources["cpus"],
"--memory",
resources["memory"],
"--log-driver",
"loki",
"--log-opt",
f"loki-url={LOKI_URL}",
"--log-opt",
f"loki-external-labels=job=gha-runner,lane={lane.lane},runner={lane.runner_name}",
]
# GPU passthrough for ai-lab lane only
gpus = resources.get("gpus", "")
if gpus:
cmd.extend(["--gpus", gpus])
cmd.extend(["-e", "NVIDIA_VISIBLE_DEVICES=all"])
cmd.extend(["-e", "NVIDIA_DRIVER_CAPABILITIES=compute,utility"])
cmd.extend([
"-e",
f"REPO_URL=https://github.com/{repo}",
"-e",
f"RUNNER_NAME={lane.runner_name}",
"-e",
f"RUNNER_TOKEN={token}",
"-e",
f"LABELS={lane.labels}",
"-e",
"RUNNER_WORKDIR=/tmp/runner/_work",
"-v",
"/var/run/docker.sock:/var/run/docker.sock",
image,
])
run_cmd(cmd)


def cmd_up(repo: str, image: str) -> int:
Expand Down
9 changes: 9 additions & 0 deletions pmoves/tools/runner_lane_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ def evaluate_phase(
else:
notes.append(f"[{phase_name}] cannot validate offline state without --check-gh: {lane}")

min_runners = int(phase_cfg.get("min_runners", 0))
if min_runners > 0 and check_gh:
distinct_names = {r.name for r in runners if r.online}
if len(distinct_names) < min_runners:
failures.append(
f"[{phase_name}] min_runners={min_runners} requires {min_runners} distinct "
f"online runners, found {len(distinct_names)}: {sorted(distinct_names)}"
)

return failures, notes


Expand Down
Loading