about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-10-24T14·16-0400
committerwpcarro <wpcarro@gmail.com>2022-11-01T22·11+0000
commit1cd7678bdbbc160c13afb28a7ea31c01c9904432 (patch)
tree7ea0dbcd617186fae080a917f33685e4c79add84 /nix
parent9ada456260c0fff256f08a6aa87c436a0027f318 (diff)
feat(ops/buildkite): Support "soft failures" r/5227
Example Usage:

```nix
{ pkgs, ... }:

(pkgs.writeText "foo" "bar").overrideAttrs (_: {
  meta.ci.extraSteps.bar = {
    label = "testing soft_fail";
    softFail = [
      { exit_status = 253; }
      { exit_status = 251; }
    ];
    command = pkgs.writeShellScript "fail" ''
      # Trigger a soft failure by exiting 253 or 251
      exit 253
    '';
  };
})
```

Buildkite Documentation: https://buildkite.com/changelog/56-command-steps-can-now-be-made-to-soft-fail

Change-Id: Idfce15a8d9cde568aa24ebd03956ada399bba5d2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7076
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'nix')
-rw-r--r--nix/buildkite/default.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/nix/buildkite/default.nix b/nix/buildkite/default.nix
index ccd98e532c..b04dc55a0b 100644
--- a/nix/buildkite/default.nix
+++ b/nix/buildkite/default.nix
@@ -331,6 +331,7 @@ rec {
     , branches ? null
     , alwaysRun ? false
     , prompt ? false
+    , softFail ? false
 
       # TODO(tazjin): Default to 'build' after 2022-10-01.
     , phase ? if (isNull postBuild || !postBuild) then "build" else "release"
@@ -363,6 +364,7 @@ rec {
         needsOutput
         parent
         parentLabel
+        softFail
         skip
         agents;
 
@@ -430,6 +432,8 @@ rec {
           echo '+++ Running extra step command'
           exec ${cfg.command}
         '';
+
+        soft_fail = cfg.softFail;
       } // (lib.optionalAttrs (cfg.agents != null) { inherit (cfg) agents; })
       // (lib.optionalAttrs (cfg.branches != null) {
         branches = lib.concatStringsSep " " cfg.branches;