chore(nix): make the target attribute a constant
Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
parent
f647440f86
commit
fd058a5022
|
@ -32,6 +32,8 @@ from .binary_cache import S3BinaryCacheConfig
|
|||
|
||||
log = Logger()
|
||||
|
||||
FLAKE_TARGET_ATTRIBUTE_FOR_JOBS = "hydraJobs"
|
||||
|
||||
@dataclass
|
||||
class OAuth2Config:
|
||||
name: str
|
||||
|
@ -121,11 +123,11 @@ class BuildTrigger(steps.BuildStep):
|
|||
source = f"nix-eval-lix"
|
||||
attr = job.get("attr", "eval-error")
|
||||
name = attr
|
||||
name = f"hydraJobs.{name}"
|
||||
name = f"{FLAKE_TARGET_ATTRIBUTE_FOR_JOBS}.{name}"
|
||||
error = job.get("error")
|
||||
props = Properties()
|
||||
props.setProperty("virtual_builder_name", name, source)
|
||||
props.setProperty("status_name", f"nix-build .#hydraJobs.{attr}", source)
|
||||
props.setProperty("status_name", f"nix-build .#{FLAKE_TARGET_ATTRIBUTE_FOR_JOBS}.{attr}", source)
|
||||
props.setProperty("virtual_builder_tags", "", source)
|
||||
|
||||
if error is not None:
|
||||
|
@ -309,7 +311,7 @@ class NixEvalCommand(buildstep.ShellMixin, steps.BuildStep):
|
|||
|
||||
@defer.inlineCallbacks
|
||||
def run(self) -> Generator[Any, object, Any]:
|
||||
# run nix-eval-jobs --flake .#hydraJobs to generate the dict of stages
|
||||
# run nix-eval-jobs --flake .#$FLAKE_TARGET_ATTRIBUTE_FOR_JOBS to generate the dict of stages
|
||||
cmd: remotecommand.RemoteCommand = yield self.makeRemoteShellCommand()
|
||||
yield self.runCommand(cmd)
|
||||
|
||||
|
@ -418,7 +420,7 @@ def nix_eval_config(
|
|||
worker_count: int,
|
||||
max_memory_size: int,
|
||||
) -> util.BuilderConfig:
|
||||
"""Uses nix-eval-jobs to evaluate hydraJobs from flake.nix in parallel.
|
||||
"""Uses nix-eval-jobs to evaluate $FLAKE_TARGET_ATTRIBUTE_FOR_JOBS (`.#hydraJobs` by default) from flake.nix in parallel.
|
||||
For each evaluated attribute a new build pipeline is started.
|
||||
"""
|
||||
factory = util.BuildFactory()
|
||||
|
@ -459,7 +461,7 @@ def nix_eval_config(
|
|||
"--force-recurse",
|
||||
"--check-cache-status",
|
||||
"--flake",
|
||||
".#hydraJobs",
|
||||
f".#{FLAKE_TARGET_ATTRIBUTE_FOR_JOBS}"
|
||||
],
|
||||
haltOnFailure=True,
|
||||
locks=[eval_lock.access("exclusive")],
|
||||
|
|
Loading…
Reference in a new issue