diff options
author | Vincent Ambo <mail@tazj.in> | 2022-06-02T17·45+0000 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-06-06T12·02+0000 |
commit | 302f7e6623cb2586cc247a873dbf3d9877989dcc (patch) | |
tree | 62fb7e9503029494f89f80ac65024aa197287089 /nix/buildkite | |
parent | ebd701b221a7df872b4514aa758c7e410fedc3c8 (diff) |
feat(nix/buildkite): Allow toggling of individual phases r/4220
Using the `activePhases` attribute, the set of phases included in an evaluation can be modified. This lets users generate e.g. ONLY the release steps of a pipeline. Change-Id: Ib0c38826dd69666094d619f5f324d1baafce8134 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5828 Tested-by: BuildkiteCI Reviewed-by: ezemtsov <eugene.zemtsov@gmail.com>
Diffstat (limited to 'nix/buildkite')
-rw-r--r-- | nix/buildkite/default.nix | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/nix/buildkite/default.nix b/nix/buildkite/default.nix index 5b83f9c6618a..7b25b0a865a4 100644 --- a/nix/buildkite/default.nix +++ b/nix/buildkite/default.nix @@ -142,14 +142,26 @@ rec { # # Can be used for status reporting steps and the like. postBuildSteps ? [ ] + , # Build phases that are active for this invocation (i.e. their + # steps should be generated). + # + # This can be used to disable outputting parts of a pipeline if, + # for example, build and release phases are created in separate + # eval contexts. + # + # TODO(tazjin): Fail/warn if unknown phase is requested. + activePhases ? [ "build" "release" ] }: let - # List of phases to include. Currently the only phases are 'build' - # (Nix builds and extra steps that are not post-build steps) and - # 'post' (all post-build steps). + # Currently the only known phases are 'build' (Nix builds and + # extra steps that are not post-build steps) and 'release' (all + # post-build steps). # - # TODO(tazjin): Configurable set of phases. - phases = [ "build" "release" ]; + # TODO(tazjin): Fully configurable set of phases? + knownPhases = [ "build" "release" ]; + + # List of phases to include. + phases = lib.intersectLists activePhases knownPhases; # Convert a target into all of its steps, separated by build # phase (as phases end up in different chunks). @@ -166,7 +178,7 @@ rec { # Split extra steps by phase. splitExtraSteps = lib.groupBy ({ phase, ... }: phase) - (attrValues (mapAttrs (normaliseExtraStep phases overridable) + (attrValues (mapAttrs (normaliseExtraStep knownPhases overridable) (target.meta.ci.extraSteps or { }))); extraSteps = mapAttrs (_: steps: map mkExtraStep steps) splitExtraSteps; |