@@ -125,6 +125,7 @@ def __init__(
125
125
worker_count : int ,
126
126
max_memory_size : int ,
127
127
drv_gcroots_dir : util .Interpolate ,
128
+ show_trace : bool = False ,
128
129
** kwargs : Any ,
129
130
) -> None :
130
131
kwargs = self .setupShellMixin (kwargs )
@@ -138,6 +139,7 @@ def __init__(
138
139
self .worker_count = worker_count
139
140
self .max_memory_size = max_memory_size
140
141
self .drv_gcroots_dir = drv_gcroots_dir
142
+ self .show_trace = show_trace
141
143
142
144
async def produce_event (self , event : str , result : None | int ) -> None :
143
145
build : dict [str , Any ] = await self .master .data .get (
@@ -175,6 +177,7 @@ async def run(self) -> int:
175
177
str (self .drv_gcroots_dir ),
176
178
"--force-recurse" ,
177
179
"--check-cache-status" ,
180
+ * (["--show-trace" ] if self .show_trace else []),
178
181
"--flake" ,
179
182
f".#{ branch_config .attribute } " ,
180
183
* (
@@ -311,6 +314,7 @@ class CachedFailureStep(steps.BuildStep):
311
314
post_build_steps : list [models .PostBuildStep ]
312
315
branch_config_dict : models .BranchConfigDict
313
316
outputs_path : Path | None
317
+ show_trace : bool
314
318
315
319
def __init__ (
316
320
self ,
@@ -319,13 +323,15 @@ def __init__(
319
323
post_build_steps : list [models .PostBuildStep ],
320
324
branch_config_dict : models .BranchConfigDict ,
321
325
outputs_path : Path | None ,
326
+ show_trace : bool = False ,
322
327
** kwargs : Any ,
323
328
) -> None :
324
329
self .project = project
325
330
self .worker_names = worker_names
326
331
self .post_build_steps = post_build_steps
327
332
self .branch_config_dict = branch_config_dict
328
333
self .outputs_path = outputs_path
334
+ self .show_trace = show_trace
329
335
330
336
super ().__init__ (** kwargs )
331
337
@@ -349,6 +355,7 @@ async def run(self) -> int:
349
355
self .post_build_steps ,
350
356
self .branch_config_dict ,
351
357
self .outputs_path ,
358
+ self .show_trace ,
352
359
)
353
360
)
354
361
return util .SUCCESS
@@ -543,6 +550,7 @@ def nix_eval_config(
543
550
max_memory_size : int ,
544
551
job_report_limit : int | None ,
545
552
failed_builds_db : FailedBuildDB ,
553
+ show_trace : bool = False ,
546
554
) -> BuilderConfig :
547
555
"""Uses nix-eval-jobs to evaluate hydraJobs from flake.nix in parallel.
548
556
For each evaluated attribute a new build pipeline is started.
@@ -583,6 +591,7 @@ def nix_eval_config(
583
591
max_memory_size = max_memory_size ,
584
592
drv_gcroots_dir = drv_gcroots_dir ,
585
593
logEnviron = False ,
594
+ show_trace = show_trace ,
586
595
),
587
596
)
588
597
@@ -656,6 +665,7 @@ def nix_build_steps(
656
665
post_build_steps : list [steps .BuildStep ],
657
666
branch_config : models .BranchConfigDict ,
658
667
outputs_path : Path | None = None ,
668
+ show_trace : bool = False ,
659
669
) -> list [steps .BuildStep ]:
660
670
out_steps = [
661
671
NixBuildCommand (
@@ -666,6 +676,7 @@ def nix_build_steps(
666
676
"nix" ,
667
677
"build" ,
668
678
"-L" ,
679
+ * (["--show-trace" ] if show_trace else []),
669
680
"--option" ,
670
681
"keep-going" ,
671
682
"true" ,
@@ -723,12 +734,18 @@ def nix_build_config(
723
734
post_build_steps : list [steps .BuildStep ],
724
735
branch_config_dict : models .BranchConfigDict ,
725
736
outputs_path : Path | None = None ,
737
+ show_trace : bool = False ,
726
738
) -> BuilderConfig :
727
739
"""Builds one nix flake attribute."""
728
740
factory = util .BuildFactory ()
729
741
factory .addSteps (
730
742
nix_build_steps (
731
- project , worker_names , post_build_steps , branch_config_dict , outputs_path
743
+ project ,
744
+ worker_names ,
745
+ post_build_steps ,
746
+ branch_config_dict ,
747
+ outputs_path ,
748
+ show_trace ,
732
749
)
733
750
)
734
751
@@ -795,6 +812,7 @@ def nix_cached_failure_config(
795
812
branch_config_dict : models .BranchConfigDict ,
796
813
post_build_steps : list [steps .BuildStep ],
797
814
outputs_path : Path | None = None ,
815
+ show_trace : bool = False ,
798
816
) -> BuilderConfig :
799
817
"""Dummy builder that is triggered when a build is cached as failed."""
800
818
factory = util .BuildFactory ()
@@ -808,6 +826,7 @@ def nix_cached_failure_config(
808
826
name = "Cached failure" ,
809
827
haltOnFailure = True ,
810
828
flunkOnFailure = True ,
829
+ show_trace = show_trace ,
811
830
),
812
831
)
813
832
@@ -980,6 +999,7 @@ def config_for_project(
980
999
per_repo_effects_secrets : dict [str , str ],
981
1000
branch_config_dict : models .BranchConfigDict ,
982
1001
outputs_path : Path | None = None ,
1002
+ show_trace : bool = False ,
983
1003
) -> None :
984
1004
config ["projects" ].append (Project (project .name ))
985
1005
config ["schedulers" ].extend (
@@ -1086,13 +1106,15 @@ def config_for_project(
1086
1106
max_memory_size = nix_eval_max_memory_size ,
1087
1107
eval_lock = eval_lock ,
1088
1108
failed_builds_db = failed_builds_db ,
1109
+ show_trace = show_trace ,
1089
1110
),
1090
1111
nix_build_config (
1091
1112
project ,
1092
1113
worker_names ,
1093
1114
outputs_path = outputs_path ,
1094
1115
branch_config_dict = branch_config_dict ,
1095
1116
post_build_steps = post_build_steps ,
1117
+ show_trace = show_trace ,
1096
1118
),
1097
1119
buildbot_effects_config (
1098
1120
project ,
@@ -1115,6 +1137,7 @@ def config_for_project(
1115
1137
branch_config_dict = branch_config_dict ,
1116
1138
post_build_steps = post_build_steps ,
1117
1139
outputs_path = outputs_path ,
1140
+ show_trace = show_trace ,
1118
1141
),
1119
1142
nix_register_gcroot_config (project , worker_names ),
1120
1143
],
@@ -1334,6 +1357,7 @@ def configure(self, config: dict[str, Any]) -> None:
1334
1357
failed_builds_db = DB ,
1335
1358
branch_config_dict = self .config .branches ,
1336
1359
outputs_path = self .config .outputs_path ,
1360
+ show_trace = self .config .show_trace_on_failure ,
1337
1361
)
1338
1362
except Exception : # noqa: BLE001
1339
1363
log .failure (f"Failed to configure project { project .name } " )
0 commit comments