@@ -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
@@ -658,6 +667,7 @@ def nix_build_steps(
658
667
post_build_steps : list [steps .BuildStep ],
659
668
branch_config : models .BranchConfigDict ,
660
669
outputs_path : Path | None = None ,
670
+ show_trace : bool = False ,
661
671
) -> list [steps .BuildStep ]:
662
672
out_steps = [
663
673
NixBuildCommand (
@@ -668,6 +678,7 @@ def nix_build_steps(
668
678
"nix" ,
669
679
"build" ,
670
680
"-L" ,
681
+ * (["--show-trace" ] if show_trace else []),
671
682
"--option" ,
672
683
"keep-going" ,
673
684
"true" ,
@@ -725,12 +736,18 @@ def nix_build_config(
725
736
post_build_steps : list [steps .BuildStep ],
726
737
branch_config_dict : models .BranchConfigDict ,
727
738
outputs_path : Path | None = None ,
739
+ show_trace : bool = False ,
728
740
) -> BuilderConfig :
729
741
"""Builds one nix flake attribute."""
730
742
factory = util .BuildFactory ()
731
743
factory .addSteps (
732
744
nix_build_steps (
733
- project , worker_names , post_build_steps , branch_config_dict , outputs_path
745
+ project ,
746
+ worker_names ,
747
+ post_build_steps ,
748
+ branch_config_dict ,
749
+ outputs_path ,
750
+ show_trace ,
734
751
)
735
752
)
736
753
@@ -797,6 +814,7 @@ def nix_cached_failure_config(
797
814
branch_config_dict : models .BranchConfigDict ,
798
815
post_build_steps : list [steps .BuildStep ],
799
816
outputs_path : Path | None = None ,
817
+ show_trace : bool = False ,
800
818
) -> BuilderConfig :
801
819
"""Dummy builder that is triggered when a build is cached as failed."""
802
820
factory = util .BuildFactory ()
@@ -810,6 +828,7 @@ def nix_cached_failure_config(
810
828
name = "Cached failure" ,
811
829
haltOnFailure = True ,
812
830
flunkOnFailure = True ,
831
+ show_trace = show_trace ,
813
832
),
814
833
)
815
834
@@ -984,6 +1003,7 @@ def config_for_project(
984
1003
per_repo_effects_secrets : dict [str , str ],
985
1004
branch_config_dict : models .BranchConfigDict ,
986
1005
outputs_path : Path | None = None ,
1006
+ show_trace : bool = False ,
987
1007
) -> None :
988
1008
config ["projects" ].append (Project (project .name ))
989
1009
config ["schedulers" ].extend (
@@ -1090,13 +1110,15 @@ def config_for_project(
1090
1110
max_memory_size = nix_eval_max_memory_size ,
1091
1111
eval_lock = eval_lock ,
1092
1112
failed_builds_db = failed_builds_db ,
1113
+ show_trace = show_trace ,
1093
1114
),
1094
1115
nix_build_config (
1095
1116
project ,
1096
1117
worker_names ,
1097
1118
outputs_path = outputs_path ,
1098
1119
branch_config_dict = branch_config_dict ,
1099
1120
post_build_steps = post_build_steps ,
1121
+ show_trace = show_trace ,
1100
1122
),
1101
1123
buildbot_effects_config (
1102
1124
project ,
@@ -1119,6 +1141,7 @@ def config_for_project(
1119
1141
branch_config_dict = branch_config_dict ,
1120
1142
post_build_steps = post_build_steps ,
1121
1143
outputs_path = outputs_path ,
1144
+ show_trace = show_trace ,
1122
1145
),
1123
1146
nix_register_gcroot_config (project , worker_names ),
1124
1147
],
@@ -1338,6 +1361,7 @@ def configure(self, config: dict[str, Any]) -> None:
1338
1361
failed_builds_db = DB ,
1339
1362
branch_config_dict = self .config .branches ,
1340
1363
outputs_path = self .config .outputs_path ,
1364
+ show_trace = self .config .show_trace_on_failure ,
1341
1365
)
1342
1366
except Exception : # noqa: BLE001
1343
1367
log .failure (f"Failed to configure project { project .name } " )
0 commit comments