Skip to content

Commit 588b1f8

Browse files
committed
nixos/github-runners: make enable functional
Fixes #305304
1 parent 90a3274 commit 588b1f8

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

nixos/modules/services/continuous-integration/github-runner/service.nix

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ with lib;
1919
])
2020
);
2121

22-
config.systemd.services = flip mapAttrs' config.services.github-runners (name: cfg:
22+
config.systemd.services =
23+
let enabledRunners = filterAttrs (_: cfg: cfg.enable) config.services.github-runners;
24+
in (flip mapAttrs' enabledRunners (name: cfg:
2325
let
2426
svcName = "github-runner-${name}";
2527
systemdDir = "github-runner/${name}";
@@ -296,5 +298,5 @@ with lib;
296298
cfg.serviceOverrides
297299
];
298300
}
299-
);
301+
));
300302
}

nixos/tests/github-runner.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import ./make-test-python.nix ({ pkgs, ... }:
1111
tokenFile = builtins.toFile "github-runner.token" "not-so-secret";
1212
};
1313

14+
services.github-runners.test-disabled = {
15+
enable = false;
16+
url = "https://github.com/yaxitech";
17+
tokenFile = builtins.toFile "github-runner.token" "not-so-secret";
18+
};
19+
1420
systemd.services.dummy-github-com = {
1521
wantedBy = [ "multi-user.target" ];
1622
before = [ "github-runner-test.service" ];
@@ -33,5 +39,7 @@ import ./make-test-python.nix ({ pkgs, ... }:
3339
assert "Self-hosted runner registration" in out, "did not read runner registration header"
3440
3541
machine.wait_until_succeeds("test -f /tmp/registration-connect")
42+
43+
machine.fail("systemctl list-unit-files | grep test-disabled")
3644
'';
3745
})

0 commit comments

Comments
 (0)