From 16a7c4a1be61ff8c66dbf73f2291b64a71ab8f7a Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 13 Feb 2024 18:35:38 +0100 Subject: feat(buildkite): avoid building extraSteps in pipeline construction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In principle we don't want to build any (later) pipeline target during pipeline evaluation insofar they appear in extraSteps. For this reason, we have the needsOutput mechanism which prevents the parent target of an extraStep from being built in 🦙. Unfortunately, this mechanism is not general purpose enough, as we use other (i.e. non parent) targets from depot in extraSteps. As a consequence, kind of expensive builds need to happen during pipeline construction at the moment. The solution is to use the fact that the command script we want to run is exposed via the readTree interface to depot and build the script proper only when the extra step is executed. To facilitate this, some prerequisite changes need to be made: - We need to use a symlink different to result in case needsOutput is true which needs support in mkBuildCommand. We also need to avoid this symlink being picked up by git, as many extra steps check whether the tree is dirty or not. (Is there a way to have it outside the depot tree?) - Since we rely on the build command printing a single store path we store in $command_script, we need to avoid it printing two paths in cases where nix-store(1) is used (nix-store(1) prints the symlink and readlink(1) would print the store path in a separate line). Future work would be to remove/deprecate the needsOutput mechanism: After this change the parent target wouldn't be built right away even if it appeared in the script via string interpolation. Thus we could, instead of expecting the target being available as `./result`, make our extra steps nix-ier. Change-Id: Idd2e88a865eadabe229ce1e05406e8cc4cb63f94 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10850 Reviewed-by: tazjin Autosubmit: sterni Tested-by: BuildkiteCI --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 9066757e58e4..8cdaa738f35c 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ garbage/ # Ignore Nix result symlinks result result-* +# Nix result symlink used by //nix/buildkite +/nix-buildkite-extra-step-command-script +/nix-buildkite-extra-step-command-script-* -- cgit 1.4.1