nixos/testing: allow meta.teams in tests, fix maintainer pings for tests
With this patch I essentially get the expected list of maintainers for changes in
nixos-tests.
The downside of this approach is that the CI facility assumes that
there's at most a single definition of `meta.maintainers`, however it
can be more in a module-system context.
For simplicity, just use the first definition location for the time
being.
Verified with
let
lib = import ./lib;
maintainers = import ./ci/eval/compare/maintainers.nix { inherit lib; };
in
maintainers {
changedFiles = [
"nixos/tests/matrix/matrix-authentication-service.nix"
];
affectedAttrPaths = map (lib.splitString ".") [
"nixosTests.matrix-authentication-service"
];
}
This commit is contained in:
@@ -2294,6 +2294,9 @@
|
||||
"test-opt-meta.hydraPlatforms": [
|
||||
"index.html#test-opt-meta.hydraPlatforms"
|
||||
],
|
||||
"test-opt-meta.teams": [
|
||||
"index.html#test-opt-meta.teams"
|
||||
],
|
||||
"test-opt-meta.timeout": [
|
||||
"index.html#test-opt-meta.timeout"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
{ lib, ... }:
|
||||
{ lib, options, ... }:
|
||||
let
|
||||
inherit (lib) types mkOption literalMD;
|
||||
|
||||
# Approximate position of meta.teams / meta.maintainers in nixos tests.
|
||||
# Right now this assumes only one such position and ignores other definitions.
|
||||
# FIXME allow having multiple `maintainersPosition` et al..
|
||||
getPosition =
|
||||
definitionsWithLocations:
|
||||
if definitionsWithLocations == [ ] then
|
||||
null
|
||||
else
|
||||
{
|
||||
file = (lib.head definitionsWithLocations).file;
|
||||
column = 0;
|
||||
line = 1;
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
@@ -12,7 +26,7 @@ in
|
||||
'';
|
||||
apply = lib.filterAttrs (k: v: v != null);
|
||||
type = types.submodule (
|
||||
{ config, ... }:
|
||||
{ options, config, ... }:
|
||||
{
|
||||
options = {
|
||||
maintainers = mkOption {
|
||||
@@ -22,6 +36,25 @@ in
|
||||
The [list of maintainers](https://nixos.org/manual/nixpkgs/stable/#var-meta-maintainers) for this test.
|
||||
'';
|
||||
};
|
||||
maintainersPosition = mkOption {
|
||||
internal = true;
|
||||
readOnly = true;
|
||||
type = types.nullOr types.attrs;
|
||||
default = getPosition options.maintainers.definitionsWithLocations;
|
||||
};
|
||||
teams = mkOption {
|
||||
type = types.listOf types.raw;
|
||||
default = [ ];
|
||||
description = ''
|
||||
The [list of maintainer-teams](https://nixos.org/manual/nixpkgs/stable/#var-meta-teams) for this test.
|
||||
'';
|
||||
};
|
||||
teamsPosition = mkOption {
|
||||
internal = true;
|
||||
readOnly = true;
|
||||
type = types.nullOr types.attrs;
|
||||
default = getPosition options.teams.definitionsWithLocations;
|
||||
};
|
||||
timeout = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
default = 3600; # 1 hour
|
||||
|
||||
Reference in New Issue
Block a user