feat: non-flakes entrypoint #23
|
@ -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,26 +396,11 @@ 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")
|
|
||||||
cmd = yield self.makeRemoteShellCommand(
|
|
||||||
stdioLogName=None,
|
|
||||||
collectStdout=True,
|
|
||||||
command=(
|
|
||||||
["nix", "derivation", "show", "--recursive"]
|
|
||||||
+ [ drv for drv in (job.get("drvPath") for job in filtered_jobs) if drv ]
|
|
||||||
),
|
|
||||||
)
|
|
||||||
yield self.runCommand(cmd)
|
|
||||||
drv_show_log.addStdout(f"done\n")
|
|
||||||
try:
|
|
||||||
drv_info = json.loads(cmd.stdout)
|
|
||||||
except json.JSONDecodeError as e:
|
|
||||||
msg = f"Failed to parse `nix derivation show` output for {cmd.command}"
|
|
||||||
raise BuildbotNixError(msg) from e
|
|
||||||
all_deps = dict()
|
all_deps = dict()
|
||||||
for drv, info in drv_info.items():
|
|
||||||
all_deps[drv] = set(info.get("inputDrvs").keys())
|
|
||||||
|
|
||||||
def closure_of(key, deps):
|
def closure_of(key, deps):
|
||||||
r, size = set([key]), 0
|
r, size = set([key]), 0
|
||||||
|
@ -425,8 +409,28 @@ class NixEvalCommand(buildstep.ShellMixin, steps.BuildStep):
|
||||||
r.update(*[ deps[k] for k in r ])
|
r.update(*[ deps[k] for k in r ])
|
||||||
return r.difference([key])
|
return r.difference([key])
|
||||||
|
|
||||||
job_set = set(( drv for drv in ( job.get("drvPath") for job in filtered_jobs ) if drv ))
|
if succeeded_jobs:
|
||||||
all_deps = { k: list(closure_of(k, all_deps).intersection(job_set)) for k in job_set }
|
drv_show_log.addStdout(f"getting derivation infos for valid derivations\n")
|
||||||
|
cmd = yield self.makeRemoteShellCommand(
|
||||||
|
stdioLogName=None,
|
||||||
|
collectStdout=True,
|
||||||
|
command=(
|
||||||
|
["nix", "derivation", "show", "--recursive"]
|
||||||
|
+ [ drv for drv in (job.get("drvPath") for job in succeeded_jobs) if drv ]
|
||||||
|
),
|
||||||
|
)
|
||||||
|
yield self.runCommand(cmd)
|
||||||
|
drv_show_log.addStdout(f"done\n")
|
||||||
|
try:
|
||||||
|
drv_info = json.loads(cmd.stdout)
|
||||||
|
except json.JSONDecodeError as e:
|
||||||
|
msg = f"Failed to parse `nix derivation show` output for {cmd.command}"
|
||||||
|
raise BuildbotNixError(msg) from e
|
||||||
|
for drv, info in drv_info.items():
|
||||||
|
all_deps[drv] = set(info.get("inputDrvs").keys())
|
||||||
|
|
||||||
|
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 }
|
||||||
|
|
||||||
self.build.addStepsAfterCurrentStep(
|
self.build.addStepsAfterCurrentStep(
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in a new issue