chore(nix): make the target attribute a constant
Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
parent
c09da505c1
commit
ec9834b0d3
|
@ -34,6 +34,8 @@ from .binary_cache import S3BinaryCacheConfig
|
|||
|
||||
log = Logger()
|
||||
|
||||
FLAKE_TARGET_ATTRIBUTE_FOR_JOBS = "hydraJobs"
|
||||
|
||||
@dataclass
|
||||
class OAuth2Config:
|
||||
name: str
|
||||
|
@ -155,11 +157,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:
|
||||
|
@ -343,7 +345,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)
|
||||
|
||||
|
@ -452,7 +454,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()
|
||||
|
@ -490,7 +492,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