Merge pull request 'Barebones ci-runner module' (#108) from feature/ci-runner-onecommit into main

Reviewed-on: https://git.b12f.io/pub-solar/os/pulls/108
Reviewed-by: hensoko <hensoko@noreply.example.org>
This commit is contained in:
Benjamin Bädorf 2022-08-25 21:46:22 +00:00
commit c7affb6533
No known key found for this signature in database
GPG key ID: 5FEAFA6A0FC8075D
2 changed files with 42 additions and 1 deletions

View file

@ -0,0 +1,41 @@
{ lib, config, pkgs, self, ... }:
with lib;
let
psCfg = config.pub-solar;
cfg = config.pub-solar.ci-runner;
in
{
options.pub-solar.ci-runner = {
enable = mkEnableOption "Enables a systemd service that runs drone-ci-runner";
};
config = mkIf cfg.enable {
systemd.user.services.ci-runner = {
enable = true;
description = "CI runner for the PubSolarOS repository that can run test VM instances with KVM.";
serviceConfig = {
Type = "simple";
Restart = "always";
};
path = [
pkgs.git
pkgs.nix
pkgs.libvirt
];
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "libvirtd.service" ];
script = ''${pkgs.drone-runner-exec}/bin/drone-runner-exec daemon /run/agenix/drone-runner-exec-config'';
};
age.secrets."drone-runner-exec-config" = {
file = "${self}/secrets/drone-runner-exec-config";
mode = "700";
owner = psCfg.user.name;
};
};
}

View file

@ -6,7 +6,7 @@ self: with self; ''
--env=DRONE_RPC_PROTO=$DRONE_RPC_PROTO \
--env=DRONE_RPC_HOST=$DRONE_RPC_HOST \
--env=DRONE_RPC_SECRET=$(${self.libsecret}/bin/secret-tool lookup drone rpc-secret) \
--env=DRONE_RUNNER_CAPACITY=4 \
--env=DRONE_RUNNER_CAPACITY=8 \
--env=DRONE_RUNNER_NAME=$(${self.inetutils}/bin/hostname) \
--publish=3000:3000 \
--restart=always \