about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorEvgeny Zemtsov <eze@resoptima.com>2022-09-30T12·21+0200
committerclbot <clbot@tvl.fyi>2022-09-30T13·14+0000
commit335bf6900d9cc3f8e94a40f567423fbb07878e36 (patch)
tree0f562d1019f713495fd8f632de905d7f580013f1 /nix
parent68a4d4a759f4e71832d99db15ceccc992b1fa0dd (diff)
fix(nix/buildkite): follow parent skip behavior in extra steps r/5007
We found a bug after updating to latest tvl-kit which broke
incremental releases.

Bug was related to the fact that extra steps skip attribute had
precedence over parent configuration. This is a desired behavior when
extra step is explicitly set to `skip=true` but otherwise it must
follow parent.

Due to extra step normalization skip parameter is always set to false
if not explicitly set.

Along the way, I'm adding support for setting skip attribute on extra
steps as string so that people can define skip reasons.

The bug was introduced by commit:
b9d79109d feat(ops/buildkite): Allow skip of individual steps

Change-Id: I8a46d0926a749d2434412b309c661b749e9dbf37
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6827
Autosubmit: ezemtsov <eugene.zemtsov@gmail.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'nix')
-rw-r--r--nix/buildkite/default.nix13
1 files changed, 12 insertions, 1 deletions
diff --git a/nix/buildkite/default.nix b/nix/buildkite/default.nix
index f588b27b52f2..510c68673b9f 100644
--- a/nix/buildkite/default.nix
+++ b/nix/buildkite/default.nix
@@ -397,7 +397,18 @@ rec {
     let
       step = {
         label = ":gear: ${cfg.label} (from ${cfg.parentLabel})";
-        skip = if cfg.alwaysRun then false else cfg.skip or cfg.parent.skip or false;
+        skip =
+          let
+            # When parent doesn't have skip attribute set, default to false
+            parentSkip = cfg.parent.skip or false;
+            # Extra step skip parameter can be string explaining the
+            # skip reason.
+            extraStepSkip = if builtins.isString cfg.skip then true else cfg.skip;
+            # Don't run if extra step is explicitly set to skip. If
+            # parameter is not set or equal to false, follow parent behavior.
+            skip' = if extraStepSkip then cfg.skip else parentSkip;
+          in
+          if cfg.alwaysRun then false else skip';
 
         depends_on = lib.optional
           (buildEnabled && !cfg.alwaysRun && !cfg.needsOutput)