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 <tazjin@tvl.su>
This commit is contained in:
Jean-François Roche 2022-07-25 10:15:30 +02:00
parent 45c794f1b3
commit 282ad0015b

View file

@ -396,10 +396,6 @@ rec {
(buildEnabled && !cfg.alwaysRun && !cfg.needsOutput) (buildEnabled && !cfg.alwaysRun && !cfg.needsOutput)
cfg.parent.key; cfg.parent.key;
branches =
if cfg.branches != null
then lib.concatStringsSep " " cfg.branches else null;
command = pkgs.writeShellScript "${cfg.key}-script" '' command = pkgs.writeShellScript "${cfg.key}-script" ''
set -ueo pipefail set -ueo pipefail
${lib.optionalString cfg.needsOutput ${lib.optionalString cfg.needsOutput
@ -409,7 +405,10 @@ rec {
echo '+++ Running extra step command' echo '+++ Running extra step command'
exec ${cfg.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 in
if (isString cfg.prompt) if (isString cfg.prompt)
then then