Skip to content

Commit

Permalink
Wait for GHA eval results instead of falling back to local evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage committed Jan 5, 2025
1 parent ad39cac commit c353a62
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions nixpkgs_review/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import subprocess
import sys
import tempfile
import time
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
Expand Down Expand Up @@ -296,14 +297,23 @@ def build_pr(self, pr_number: int) -> dict[System, list[Attr]]:
pr = self.github_client.pull_request(pr_number)

packages_per_system: dict[System, set[str]] | None = None
if self.use_github_eval and all(system in PLATFORMS for system in self.systems):
# Attempt to fetch the GitHub actions evaluation result
print("-> Attempting to fetch eval results from GitHub actions")
packages_per_system = self.github_client.get_github_action_eval_result(pr)

if packages_per_system is not None:
print("-> Successfully fetched rebuilds: no local evaluation needed")
if self.use_github_eval:
assert all(system in PLATFORMS for system in self.systems)
print("-> Fetching eval results from GitHub actions")

packages_per_system = self.github_client.get_github_action_eval_result(pr)
if packages_per_system is None:
timeout: int = 10
print(f"...Results are not (yet) available. Retrying in {timeout}s")
while packages_per_system is None:
sys.stdout.flush()
print(".")
time.sleep(timeout)
packages_per_system = (
self.github_client.get_github_action_eval_result(pr)
)

print("-> Successfully fetched rebuilds: no local evaluation needed")
else:
packages_per_system = None

Expand Down

0 comments on commit c353a62

Please sign in to comment.