about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2023-03-06 17:38:35 +0000
committerMartin Weinelt <hexa@darmstadt.ccc.de>2023-03-06 17:38:35 +0000
commit86eedea2fe42f55209a31fc81e391859c57271c6 (patch)
treea9d01e802aef8ff62884f52ec7bc956a29cfd4de /nixos
parent6d87b5b48ef038163bca333b653ee06fbd153200 (diff)
parentd270ccbd390b077e2b72aae4784548ce16758841 (diff)
downloadnixlib-86eedea2fe42f55209a31fc81e391859c57271c6.tar
nixlib-86eedea2fe42f55209a31fc81e391859c57271c6.tar.gz
nixlib-86eedea2fe42f55209a31fc81e391859c57271c6.tar.bz2
nixlib-86eedea2fe42f55209a31fc81e391859c57271c6.tar.lz
nixlib-86eedea2fe42f55209a31fc81e391859c57271c6.tar.xz
nixlib-86eedea2fe42f55209a31fc81e391859c57271c6.tar.zst
nixlib-86eedea2fe42f55209a31fc81e391859c57271c6.zip
Merge remote-tracking branch 'origin/master' into staging-next
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/continuous-integration/github-runner/service.nix2
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/github-runner.nix37
3 files changed, 39 insertions, 1 deletions
diff --git a/nixos/modules/services/continuous-integration/github-runner/service.nix b/nixos/modules/services/continuous-integration/github-runner/service.nix
index 3d11728ebfdd..55df83362cb6 100644
--- a/nixos/modules/services/continuous-integration/github-runner/service.nix
+++ b/nixos/modules/services/continuous-integration/github-runner/service.nix
@@ -149,7 +149,7 @@ in
               else
                 args+=(--token "$token")
               fi
-              ${cfg.package}/bin/config.sh "''${args[@]}"
+              ${cfg.package}/bin/Runner.Listener configure "''${args[@]}"
               # Move the automatically created _diag dir to the logs dir
               mkdir -p  "$STATE_DIRECTORY/_diag"
               cp    -r  "$STATE_DIRECTORY/_diag/." "$LOGS_DIRECTORY/"
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 5aeb68fdef0c..a7206aba0a5a 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -244,6 +244,7 @@ in {
   ghostunnel = handleTest ./ghostunnel.nix {};
   gitdaemon = handleTest ./gitdaemon.nix {};
   gitea = handleTest ./gitea.nix { giteaPackage = pkgs.gitea; };
+  github-runner = handleTest ./github-runner.nix {};
   gitlab = handleTest ./gitlab.nix {};
   gitolite = handleTest ./gitolite.nix {};
   gitolite-fcgiwrap = handleTest ./gitolite-fcgiwrap.nix {};
diff --git a/nixos/tests/github-runner.nix b/nixos/tests/github-runner.nix
new file mode 100644
index 000000000000..033365d6925c
--- /dev/null
+++ b/nixos/tests/github-runner.nix
@@ -0,0 +1,37 @@
+import ./make-test-python.nix ({ pkgs, ... }:
+{
+  name = "github-runner";
+  meta = with pkgs.lib.maintainers; {
+    maintainers = [ veehaitch ];
+  };
+  nodes.machine = { pkgs, ... }: {
+    services.github-runners.test = {
+      enable = true;
+      url = "https://github.com/yaxitech";
+      tokenFile = builtins.toFile "github-runner.token" "not-so-secret";
+    };
+
+    systemd.services.dummy-github-com = {
+      wantedBy = [ "multi-user.target" ];
+      before = [ "github-runner-test.service" ];
+      script = "${pkgs.netcat}/bin/nc -Fl 443 | true && touch /tmp/registration-connect";
+    };
+    networking.hosts."127.0.0.1" = [ "api.github.com" ];
+  };
+
+  testScript = ''
+    start_all()
+
+    machine.wait_for_unit("dummy-github-com")
+
+    try:
+      machine.wait_for_unit("github-runner-test")
+    except Exception:
+      pass
+
+    out = machine.succeed("journalctl -u github-runner-test")
+    assert "Self-hosted runner registration" in out, "did not read runner registration header"
+
+    machine.wait_until_succeeds("test -f /tmp/registration-connect")
+  '';
+})