diff --git a/nixos/tests/gitlab/runner.nix b/nixos/tests/gitlab/runner.nix index 7c95c02ac382..4d920e016080 100644 --- a/nixos/tests/gitlab/runner.nix +++ b/nixos/tests/gitlab/runner.nix @@ -2,8 +2,8 @@ # 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`. +# which runs all runners: +# - Shell runner in `./runner/shell-runner`. # - Start the `gitlab-runner.service`. # - Check that all runners in `gitlab` are `active`. # @@ -24,19 +24,19 @@ let runnerConfigs = { # The Gitlab runner where each job runs # on the host (not containerized and very insecure). - "shell" = { - desc = "Shell Executor (host NixOS shell, host Nix store)"; + shell = { + desc = "Shell runner (host NixOS shell, host Nix store)"; name = "shell"; tokenFile = "${runnerTokenDir}/token-shell.env"; }; - # The Gitlab runner which uses the Docker executor (we use podman). + # The Gitlab runner which uses the Docker runner (we use podman). # Features: # - Daemonizes the Nix store into a container. # - All jobs run in an unprivileged container, e.g. with image # (`local/nix`, `local/alpine`, `local/ubuntu`) - "podman" = { - desc = "Podman Executor (containers, shared containerized Nix store)"; + podman = { + desc = "Podman runner (containers, shared containerized Nix store)"; name = "podman"; tokenFile = "${runnerTokenDir}/token-podman.env"; }; @@ -53,7 +53,13 @@ in { ... }: { imports = [ - (import ./runner/shell-executor.nix { inherit runnerConfigs; }) + ../common/user-account.nix + (import ./runner/shell-runner.nix { + runnerConfig = runnerConfigs.shell; + }) + (import ./runner/podman-runner { + runnerConfig = runnerConfigs.shell; + }) ]; # Define the Gitlab Runner. @@ -156,7 +162,9 @@ in # Run all tests. test_connection() test_register_runner(name="shell", tokenFile="${runnerConfigs.shell.tokenFile}") + test_register_runner(name="podman", tokenFile="${runnerConfigs.podman.tokenFile}") restart_gitlab_runner_service() test_runner_registered(runnerConfigs["shell"]) + test_runner_registered(runnerConfigs["podman"]) ''; } diff --git a/nixos/tests/gitlab/runner/podman-executor/podman-executor.nix b/nixos/tests/gitlab/runner/podman-runner/default.nix similarity index 98% rename from nixos/tests/gitlab/runner/podman-executor/podman-executor.nix rename to nixos/tests/gitlab/runner/podman-runner/default.nix index 0e5b387ff347..d634974154e0 100644 --- a/nixos/tests/gitlab/runner/podman-executor/podman-executor.nix +++ b/nixos/tests/gitlab/runner/podman-runner/default.nix @@ -46,7 +46,6 @@ # to set `.execConfig.User = 'ci'` # and see if we can start it with out requiring root. { - config, lib, pkgs, ... @@ -58,7 +57,7 @@ let owner = "NixOS"; repo = "nix"; rev = "2.32.4"; - hash = "sha256-7D4m+saJjbSFP5hOwpQq2FGR2rr+psQMTcyb1ZvtXsQ="; + hash = "sha256-8QYnRyGOTm3h/Dp8I6HCmQzlO7C009Odqyp28pTWgcY="; }; # Either we use a Nix as the base image or Alpine. @@ -71,7 +70,7 @@ let all = with imageNames; [ alpine - nixRepo + nix ubuntu ]; }; @@ -85,7 +84,7 @@ let # derivation will be symlinked in `/`. auxRootFiles = fs.toSource { root = ./root; - fileset = fs.gitTracked ./root/etc; + fileset = ./root/etc; }; preBuildScript = pkgs.callPackage ./scripts/prebuild.nix { }; @@ -356,6 +355,7 @@ let in { + imports = [ ./virtualization.nix ]; virtualisation.oci-containers = { backend = "podman"; @@ -381,7 +381,7 @@ in inherit registrationFlags; - authenticationTokenConfigFile = config.age.secrets.gitlab-runner-token-config.path; + authenticationTokenConfigFile = runnerConfig.tokenFile; executor = "docker"; dockerImage = imageNames.default; diff --git a/nixos/tests/gitlab/runner/podman-executor/root/README.md b/nixos/tests/gitlab/runner/podman-runner/root/README.md similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/root/README.md rename to nixos/tests/gitlab/runner/podman-runner/root/README.md diff --git a/nixos/tests/gitlab/runner/podman-executor/root/etc/containers/containers.conf b/nixos/tests/gitlab/runner/podman-runner/root/etc/containers/containers.conf similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/root/etc/containers/containers.conf rename to nixos/tests/gitlab/runner/podman-runner/root/etc/containers/containers.conf diff --git a/nixos/tests/gitlab/runner/podman-executor/root/etc/containers/mounts.conf b/nixos/tests/gitlab/runner/podman-runner/root/etc/containers/mounts.conf similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/root/etc/containers/mounts.conf rename to nixos/tests/gitlab/runner/podman-runner/root/etc/containers/mounts.conf diff --git a/nixos/tests/gitlab/runner/podman-executor/root/etc/containers/policy.json b/nixos/tests/gitlab/runner/podman-runner/root/etc/containers/policy.json similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/root/etc/containers/policy.json rename to nixos/tests/gitlab/runner/podman-runner/root/etc/containers/policy.json diff --git a/nixos/tests/gitlab/runner/podman-executor/root/etc/containers/registries.conf b/nixos/tests/gitlab/runner/podman-runner/root/etc/containers/registries.conf similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/root/etc/containers/registries.conf rename to nixos/tests/gitlab/runner/podman-runner/root/etc/containers/registries.conf diff --git a/nixos/tests/gitlab/runner/podman-executor/root/etc/containers/registries.conf.d/000-shortnames.conf b/nixos/tests/gitlab/runner/podman-runner/root/etc/containers/registries.conf.d/000-shortnames.conf similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/root/etc/containers/registries.conf.d/000-shortnames.conf rename to nixos/tests/gitlab/runner/podman-runner/root/etc/containers/registries.conf.d/000-shortnames.conf diff --git a/nixos/tests/gitlab/runner/podman-executor/root/etc/containers/registries.d/default.yaml b/nixos/tests/gitlab/runner/podman-runner/root/etc/containers/registries.d/default.yaml similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/root/etc/containers/registries.d/default.yaml rename to nixos/tests/gitlab/runner/podman-runner/root/etc/containers/registries.d/default.yaml diff --git a/nixos/tests/gitlab/runner/podman-executor/root/etc/containers/registries.d/registry.access.redhat.com.yaml b/nixos/tests/gitlab/runner/podman-runner/root/etc/containers/registries.d/registry.access.redhat.com.yaml similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/root/etc/containers/registries.d/registry.access.redhat.com.yaml rename to nixos/tests/gitlab/runner/podman-runner/root/etc/containers/registries.d/registry.access.redhat.com.yaml diff --git a/nixos/tests/gitlab/runner/podman-executor/root/etc/containers/registries.d/registry.redhat.io.yaml b/nixos/tests/gitlab/runner/podman-runner/root/etc/containers/registries.d/registry.redhat.io.yaml similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/root/etc/containers/registries.d/registry.redhat.io.yaml rename to nixos/tests/gitlab/runner/podman-runner/root/etc/containers/registries.d/registry.redhat.io.yaml diff --git a/nixos/tests/gitlab/runner/podman-executor/root/etc/containers/storage.conf b/nixos/tests/gitlab/runner/podman-runner/root/etc/containers/storage.conf similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/root/etc/containers/storage.conf rename to nixos/tests/gitlab/runner/podman-runner/root/etc/containers/storage.conf diff --git a/nixos/tests/gitlab/runner/podman-executor/scripts/prebuild.nix b/nixos/tests/gitlab/runner/podman-runner/scripts/prebuild.nix similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/scripts/prebuild.nix rename to nixos/tests/gitlab/runner/podman-runner/scripts/prebuild.nix diff --git a/nixos/tests/gitlab/runner/podman-executor/scripts/recreate-nix-daemon-store.sh b/nixos/tests/gitlab/runner/podman-runner/scripts/recreate-nix-daemon-store.sh similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/scripts/recreate-nix-daemon-store.sh rename to nixos/tests/gitlab/runner/podman-runner/scripts/recreate-nix-daemon-store.sh diff --git a/nixos/tests/gitlab/runner/podman-executor/virtualization.nix b/nixos/tests/gitlab/runner/podman-runner/virtualization.nix similarity index 100% rename from nixos/tests/gitlab/runner/podman-executor/virtualization.nix rename to nixos/tests/gitlab/runner/podman-runner/virtualization.nix diff --git a/nixos/tests/gitlab/runner/shell-executor.nix b/nixos/tests/gitlab/runner/shell-runner.nix similarity index 82% rename from nixos/tests/gitlab/runner/shell-executor.nix rename to nixos/tests/gitlab/runner/shell-runner.nix index 6f4089a92bd9..da2eaa1b94ea 100644 --- a/nixos/tests/gitlab/runner/shell-executor.nix +++ b/nixos/tests/gitlab/runner/shell-runner.nix @@ -3,7 +3,7 @@ }: # This is the runner config for the `nixosConfiguration.services.gitlab-runner.services.X` { - services.gitlab-runner.services = { + services.gitlab-runner.services.shell-runner = { description = runnerConfig.desc; authenticationTokenConfigFile = runnerConfig.tokenFile;