mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
feat: initial v3 rewrite
This commit is contained in:
commit
0952ab4145
32 changed files with 1457 additions and 0 deletions
43
lib/impl/jobPatched.nix
Normal file
43
lib/impl/jobPatched.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
}: let
|
||||
inherit (lib) toList optionalAttrs optional;
|
||||
inherit (helpers) prependToBeforeScript appendToAfterScript filterJobVariables;
|
||||
in
|
||||
{
|
||||
key,
|
||||
job,
|
||||
pipelineName,
|
||||
nixConfig,
|
||||
}:
|
||||
job
|
||||
// (optionalAttrs nixConfig.enable (
|
||||
(prependToBeforeScript ["source setup_nix_ci \"gitlab-ci:pipeline:${pipelineName}:job-deps:${key}\""] job)
|
||||
// (appendToAfterScript ["finalize_nix_ci"] job)
|
||||
))
|
||||
// optionalAttrs nixConfig.enable (
|
||||
(let
|
||||
variables =
|
||||
(filterJobVariables false job)
|
||||
// optionalAttrs nixConfig.enableRunnerCache {
|
||||
NIX_CI_CACHE_STRATEGY = "runner";
|
||||
};
|
||||
in
|
||||
# filter empty variables
|
||||
optionalAttrs (variables != {}) {
|
||||
inherit variables;
|
||||
})
|
||||
// (let
|
||||
cache =
|
||||
(toList (job.cache or []))
|
||||
++ (optional nixConfig.enableRunnerCache {
|
||||
key = nixConfig.runnerCacheKey;
|
||||
paths = [".nix-cache/"];
|
||||
});
|
||||
in
|
||||
# filter empty cache
|
||||
optionalAttrs (cache != []) {
|
||||
inherit cache;
|
||||
})
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue