From 282ad0015b85df11a686d4fe3f8da9975210206b Mon Sep 17 00:00:00 2001 From: Jean-François Roche Date: Mon, 25 Jul 2022 10:15:30 +0200 Subject: fix(ops/buildkite): do not set branch if empty To run an extra step for all branches, user don't set the `branches` attribute. This change avoid setting `branches` to null in such a case. Change-Id: Iabf2f3d0411b037ece5584f30b29c7e65420b63f Reviewed-on: https://cl.tvl.fyi/c/depot/+/5975 Tested-by: BuildkiteCI Reviewed-by: tazjin --- nix/buildkite/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nix/buildkite/default.nix b/nix/buildkite/default.nix index 078b91094d11..5c46dcb33389 100644 --- a/nix/buildkite/default.nix +++ b/nix/buildkite/default.nix @@ -396,10 +396,6 @@ rec { (buildEnabled && !cfg.alwaysRun && !cfg.needsOutput) cfg.parent.key; - branches = - if cfg.branches != null - then lib.concatStringsSep " " cfg.branches else null; - command = pkgs.writeShellScript "${cfg.key}-script" '' set -ueo pipefail ${lib.optionalString cfg.needsOutput @@ -409,7 +405,10 @@ rec { echo '+++ Running extra step command' exec ${cfg.command} ''; - } // (lib.optionalAttrs (cfg.agents != null) { inherit (cfg) agents; }); + } // (lib.optionalAttrs (cfg.agents != null) { inherit (cfg) agents; }) + // (lib.optionalAttrs (cfg.branches != null) { + branches = lib.concatStringsSep " " cfg.branches; + }); in if (isString cfg.prompt) then -- cgit 1.4.1