mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-11 17:50:08 +01:00
chore: add test and docs for handling nix store paths in global variables
This commit is contained in:
parent
96e6fe59bf
commit
1c9e7c77c5
2 changed files with 33 additions and 0 deletions
|
|
@ -9,3 +9,14 @@ This project provides a Nix flake module that allows you to generate your `.gitl
|
||||||
- **Modularity:** Define and manage your CI configurations in a structured and modular way using Nix modules, making it easier to share and reuse CI logic across multiple projects.
|
- **Modularity:** Define and manage your CI configurations in a structured and modular way using Nix modules, making it easier to share and reuse CI logic across multiple projects.
|
||||||
|
|
||||||
This documentation will guide you through setting up and using Nix GitLab CI for your projects.
|
This documentation will guide you through setting up and using Nix GitLab CI for your projects.
|
||||||
|
|
||||||
|
## Warnings
|
||||||
|
|
||||||
|
To save you from frantically searching these docs if something doesn't work as expected, here are the most important warnings ;)
|
||||||
|
|
||||||
|
!!! warning
|
||||||
|
|
||||||
|
Do not put Nix store paths into global/pipeline variables. They will simply be passed through,
|
||||||
|
resulting in bad portability (if two runners have different archs for example, one cannot find the path).
|
||||||
|
If you need any Nix store path in env variables, always do it on the job level, there
|
||||||
|
it will automatically be computed at runtime, thus will always work no matter which runner it runs on.
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,28 @@
|
||||||
};
|
};
|
||||||
}).finalConfig;
|
}).finalConfig;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
# it doesn't make much sense to have any nix store path in variables, but we ignore it for global variables
|
||||||
|
name = "ignore store paths in global variables";
|
||||||
|
expected = {
|
||||||
|
variables = {
|
||||||
|
HELLO = "world";
|
||||||
|
CURL = toString pkgs.curl;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
actual =
|
||||||
|
(mkPipeline {
|
||||||
|
name = "test";
|
||||||
|
nixConfig.enable = true;
|
||||||
|
pipeline = {
|
||||||
|
variables = {
|
||||||
|
HELLO = "world";
|
||||||
|
CURL = toString pkgs.curl;
|
||||||
|
};
|
||||||
|
jobs = {};
|
||||||
|
};
|
||||||
|
}).finalConfig;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue