feat: prepare for non-flakes entrypoint #22
|
@ -148,7 +148,7 @@ class BuildTrigger(steps.BuildStep):
|
||||||
self.ended = False
|
self.ended = False
|
||||||
self.waitForFinishDeferred = None
|
self.waitForFinishDeferred = None
|
||||||
self.brids = []
|
self.brids = []
|
||||||
self.description = f"building {len(jobs)} hydra jobs"
|
self.description = f"building {len(jobs)} jobs"
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
def interrupt(self, reason):
|
def interrupt(self, reason):
|
||||||
|
@ -177,15 +177,14 @@ class BuildTrigger(steps.BuildStep):
|
||||||
return sch
|
return sch
|
||||||
|
|
||||||
def schedule_one(self, build_props: Properties, job):
|
def schedule_one(self, build_props: Properties, job):
|
||||||
project_name = build_props.getProperty("event.refUpdate.project")
|
project_name = build_props.getProperty('event.project')
|
||||||
source = f"{project_name}-eval"
|
source = f"{project_name}-eval"
|
||||||
attr = job.get("attr", "eval-error")
|
attr = job.get("attr", "eval-error")
|
||||||
name = attr
|
name = f"buildbotJobs.{attr}"
|
||||||
|
|||||||
name = f"{FLAKE_TARGET_ATTRIBUTE_FOR_JOBS}.{name}"
|
|
||||||
error = job.get("error")
|
error = job.get("error")
|
||||||
props = Properties()
|
props = Properties()
|
||||||
props.setProperty("virtual_builder_name", name, source)
|
props.setProperty("virtual_builder_name", name, source)
|
||||||
props.setProperty("status_name", f"nix-build .#{FLAKE_TARGET_ATTRIBUTE_FOR_JOBS}.{attr}", source)
|
props.setProperty("status_name", f"building buildbotJobs.{attr}", source)
|
||||||
props.setProperty("virtual_builder_tags", "", source)
|
props.setProperty("virtual_builder_tags", "", source)
|
||||||
|
|
||||||
if error is not None:
|
if error is not None:
|
||||||
|
@ -397,14 +396,27 @@ class NixEvalCommand(buildstep.ShellMixin, steps.BuildStep):
|
||||||
if not system or system in self.supported_systems: # report eval errors
|
if not system or system in self.supported_systems: # report eval errors
|
||||||
filtered_jobs.append(job)
|
filtered_jobs.append(job)
|
||||||
|
|
||||||
|
# Filter out failed evaluations
|
||||||
|
succeeded_jobs = [job for job in filtered_jobs if job.get('error') is None]
|
||||||
|
|
||||||
drv_show_log: Log = yield self.getLog("stdio")
|
drv_show_log: Log = yield self.getLog("stdio")
|
||||||
drv_show_log.addStdout(f"getting derivation infos\n")
|
all_deps = dict()
|
||||||
|
|
||||||
|
def closure_of(key, deps):
|
||||||
|
r, size = set([key]), 0
|
||||||
|
while len(r) != size:
|
||||||
|
size = len(r)
|
||||||
|
r.update(*[ deps[k] for k in r ])
|
||||||
|
return r.difference([key])
|
||||||
|
|
||||||
|
if succeeded_jobs:
|
||||||
|
drv_show_log.addStdout(f"getting derivation infos for valid derivations\n")
|
||||||
cmd = yield self.makeRemoteShellCommand(
|
cmd = yield self.makeRemoteShellCommand(
|
||||||
stdioLogName=None,
|
stdioLogName=None,
|
||||||
collectStdout=True,
|
collectStdout=True,
|
||||||
command=(
|
command=(
|
||||||
["nix", "derivation", "show", "--recursive"]
|
["nix", "derivation", "show", "--recursive"]
|
||||||
+ [ drv for drv in (job.get("drvPath") for job in filtered_jobs) if drv ]
|
+ [ drv for drv in (job.get("drvPath") for job in succeeded_jobs) if drv ]
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
yield self.runCommand(cmd)
|
yield self.runCommand(cmd)
|
||||||
|
@ -414,17 +426,9 @@ class NixEvalCommand(buildstep.ShellMixin, steps.BuildStep):
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
msg = f"Failed to parse `nix derivation show` output for {cmd.command}"
|
msg = f"Failed to parse `nix derivation show` output for {cmd.command}"
|
||||||
raise BuildbotNixError(msg) from e
|
raise BuildbotNixError(msg) from e
|
||||||
all_deps = dict()
|
|
||||||
for drv, info in drv_info.items():
|
for drv, info in drv_info.items():
|
||||||
all_deps[drv] = set(info.get("inputDrvs").keys())
|
all_deps[drv] = set(info.get("inputDrvs").keys())
|
||||||
|
|
||||||
def closure_of(key, deps):
|
|
||||||
r, size = set([key]), 0
|
|
||||||
while len(r) != size:
|
|
||||||
size = len(r)
|
|
||||||
r.update(*[ deps[k] for k in r ])
|
|
||||||
return r.difference([key])
|
|
||||||
|
|
||||||
job_set = set(( drv for drv in ( job.get("drvPath") for job in filtered_jobs ) if drv ))
|
job_set = set(( drv for drv in ( job.get("drvPath") for job in filtered_jobs ) if drv ))
|
||||||
all_deps = { k: list(closure_of(k, all_deps).intersection(job_set)) for k in job_set }
|
all_deps = { k: list(closure_of(k, all_deps).intersection(job_set)) for k in job_set }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue
uhhhhhhhhhhhhhhhhhhhhhhhhhh this is a regression, no?
yes, this won't work on our lix stuff, I can fix it back for backward compat