diff --git a/nixos/tests/gitlab/gitlab.nix b/nixos/tests/gitlab/gitlab.nix index ce2edac32386..ccf4b3216cff 100644 --- a/nixos/tests/gitlab/gitlab.nix +++ b/nixos/tests/gitlab/gitlab.nix @@ -7,7 +7,7 @@ # - Opening and closing issues. # - Downloading repository archives as tar.gz and tar.bz2 # Run with -# [nixpkgs]$ nix-build -A nixosTests.gitlab +# [nixpkgs]$ nix-build -A nixosTests.gitlab.gitlab { pkgs, lib, ... }: diff --git a/nixos/tests/gitlab/runner.nix b/nixos/tests/gitlab/runner.nix index 2d59853321c7..9f4d5588c4f6 100644 --- a/nixos/tests/gitlab/runner.nix +++ b/nixos/tests/gitlab/runner.nix @@ -1,3 +1,15 @@ +# This test runs a gitlab-runner and performs the following tests in +# two machines `gitlab` and `gitlab-runner`: +# - Create runners in the `gitlab` machine for all runners in `./runner`. +# - Inject the runner tokens into the `gitlab-runner.service` (machine `gitlab-runner`) +# which runs all executors: +# - Shell Executor in `./runner/shell-executor`. +# - Start the `gitlab-runner.service`. +# - Check that all runners in `gitlab` are `active`. +# +# Run with +# [nixpkgs]$ nix-build -A nixosTests.gitlab.runner + { pkgs, lib, @@ -16,18 +28,21 @@ in nodes = { gitlab-runner = - { ... }: + { config, lib, ... }: { # Define the Gitlab Runner. services.gitlab-runner = { enable = true; - services.nix-runner = { - description = "NixOS Shell Executor"; - authenticationTokenConfigFile = runnerTokenFile; - executor = "shell"; + services.shell-executor = import ./runner/shell-executor.nix { + inherit config lib runnerTokenFile; }; + # TODO: Add here the container executor (podman, nixDaemon etc) + # services.container-executor = import ./runner/container-executor.nix { + # inherit config lib runnerTokenFile; + # }; + settings = { log_level = "info"; }; @@ -49,7 +64,6 @@ in virtualisation.memorySize = 6144; virtualisation.cores = 4; - # virtualisation.useNixStoreImage = true; systemd.services.gitlab.serviceConfig.Restart = lib.mkForce "no"; systemd.services.gitlab-workhorse.serviceConfig.Restart = lib.mkForce "no"; diff --git a/nixos/tests/gitlab/runner/shell-executor.nix b/nixos/tests/gitlab/runner/shell-executor.nix new file mode 100644 index 000000000000..1379e0d9f8e3 --- /dev/null +++ b/nixos/tests/gitlab/runner/shell-executor.nix @@ -0,0 +1,10 @@ +{ + config, + lib, + runnerTokenFile, +}: +{ + description = "NixOS Shell Executor"; + authenticationTokenConfigFile = runnerTokenFile; + executor = "shell"; +}