about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-01-22T11·32+0300
committerclbot <clbot@tvl.fyi>2022-01-22T11·59+0000
commit5a88e47b71ed20c4c0f0102f3ed3f8dc3ec4b454 (patch)
tree912f80d0fea103e74f5f881a4e11d44ffc48aafb /nix
parentf12ceaa6228f55f7b5a83062b147df694e72f841 (diff)
refactor(ops/pipelines): Split build/post steps into separate chunks r/3657
This will create `build-chunk-$n.json` files for steps that should run
_before_ duck, and `post-chunk-$n.json` files for steps that should
run after duck.

The post steps are not yet uploaded to Buildkite, but we also don't
have any right now.

Change-Id: I7e1b59cf55a8bf1d97266f6e988aa496959077bf
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5047
Tested-by: BuildkiteCI
Reviewed-by: ezemtsov <eugene.zemtsov@gmail.com>
Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'nix')
-rw-r--r--nix/buildkite/default.nix25
1 files changed, 9 insertions, 16 deletions
diff --git a/nix/buildkite/default.nix b/nix/buildkite/default.nix
index a471a30d75..5e31cbbc11 100644
--- a/nix/buildkite/default.nix
+++ b/nix/buildkite/default.nix
@@ -104,8 +104,8 @@ in rec {
   # Define a build pipeline chunk as a JSON file, using the pipeline
   # format documented on
   # https://buildkite.com/docs/pipelines/defining-steps.
-  makePipelineChunk = chunkId: chunk: rec {
-    filename = "chunk-${chunkId}.json";
+  makePipelineChunk = name: chunkId: chunk: rec {
+    filename = "${name}-chunk-${chunkId}.json";
     path = writeText filename (toJSON {
       steps = chunk;
     });
@@ -115,8 +115,8 @@ in rec {
   # are uploaded sequentially. This is because of a limitation in the
   # Buildkite backend which struggles to process more than a specific
   # number of chunks at once.
-  pipelineChunks = steps:
-    attrValues (mapAttrs makePipelineChunk (chunksOf 256 steps));
+  pipelineChunks = name: steps:
+    attrValues (mapAttrs (makePipelineChunk name) (chunksOf 256 steps));
 
   # Create a pipeline structure for the given targets.
   mkPipeline = {
@@ -156,24 +156,17 @@ in rec {
 
     steps = map targetToSteps drvTargets;
 
-    allSteps =
+    buildSteps =
       # Add build steps for each derivation target and their extra
       # steps.
       (lib.concatLists steps)
 
       # Add additional steps (if set).
-      ++ additionalSteps
+      ++ additionalSteps;
 
-      # Wait for all previous checks to complete
-      ++ [({
-        wait = null;
-        continue_on_failure = true;
-      })]
-
-      # Run post-build steps for status reporting and co.
-      ++ postBuildSteps;
-
-    chunks = pipelineChunks allSteps;
+    buildChunks = pipelineChunks "build" buildSteps;
+    postBuildChunks = pipelineChunks "post" postBuildSteps;
+    chunks = buildChunks ++ postBuildChunks;
   in runCommandNoCC "buildkite-pipeline" {} ''
     mkdir $out
     echo "Generated ${toString (length chunks)} pipeline chunks"