diff options
author | sterni <sternenseemann@systemli.org> | 2021-08-26T14·04+0200 |
---|---|---|
committer | sterni <sternenseemann@systemli.org> | 2021-08-26T15·24+0000 |
commit | 17d78867bbef8a3df1271137a2db18b3584cdc39 (patch) | |
tree | f08d17212e2916bb5e3ce727e264982ac7a1c94c /third_party/prometheus-fail2ban-exporter | |
parent | aad7e7e74bdb12b03fa132978556126d20c6cdfd (diff) |
feat(ops/pipelines/depot): only evaluate once if possible r/2783
We currently evaluate every target twice -- once when the depot pipeline is built and once when actually running the build step in question. Nix evaluation is quite slow especially given heavy use of import from derivation in depot, so avoiding the second evaluation is desireable. Evaluating a derivation yields a `drv` file in the nix store which can be passed to `nix-store --realise` in order to build it eliminating the need to wait for evaluation. We can obtain the path to the `drv` file while building the pipeline via `target.drvPath` and remember it for the build later. However we need to work around a flaw (or oversight) in Nix's dependency tracking via string context: This is based on derivations, not output path (because this is what evaluation deals with, likely). This is no problem per se, but an issue is that Nix can't express a dependency on a `drv` file without any of its output paths. This means for us that we either have to build all output paths at evaluation time (which we don't want, obviously) or to deal with the fact that the `drv` file we need may be garbage collected at any moment after discarding the string context -- then nix is unable to track the reference from the pipeline to the `drv` file in the store. So to prevent a race condition between the pipeline and the garbage collector we fall back to the normal nix-build invocation as we did before. Change-Id: I9ef8bd233085dc6e30eba54f403ea03ac2d35748 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3426 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'third_party/prometheus-fail2ban-exporter')
0 files changed, 0 insertions, 0 deletions