Commit 7b9727b0 authored by Valentin Reis's avatar Valentin Reis

adds concurrency option to gitlab runners

parent b8810e2f
Pipeline #7756 passed with stages
in 25 minutes and 16 seconds
......@@ -78,7 +78,7 @@ these are deployed via NixOps:
- there are four shell scripts in [deployments/](deployments/) that can be used to redeploy, reboot, and restart systemd services.
- access is granted to all keys in [deployment/keys](deployment/keys) so submit a pull request and ask someone to redeploy if you need access.
The gitlab-runner service is called "gitlab-runner2" on the machines. That
The gitlab-runner service is called "gitlabrunner" on the machines. That
systemd service registers runners on ExecStart and unregisters them on
ExecStop, so excess IPs will have to be merged manually from the gitlab
[runner
......
No preview for this file type
......@@ -6,7 +6,7 @@ let
argopkgs = import ../pkgs {};
hydraSrc = builtins.fetchTarball https://github.com/nixos/hydra/archive/master.tar.gz;
argomodules = import ../modules/module-list.nix;
mkChameleonRunner = ip: name: { ... }:
mkChameleonRunner = ip: { ... }:
{
deployment.targetEnv = "none";
deployment.targetHost = ip;
......@@ -56,10 +56,10 @@ let
virtualisation.docker.enable = true;
services.gitlab-runner2.enable = true;
services.gitlab-runner2.name = name;
services.gitlab-runner2.registrationConfigFile = "/run/gitlab.cfg";
services.gitlab-runner2.packages = [pkgs.bash pkgs.docker-machine pkgs.shadow pkgs.git];
services.gitlabrunner.enable = true;
services.gitlabrunner.name = "chameleon-runner-"+ip;
services.gitlabrunner.registrationConfigFile = "/run/gitlab.cfg";
services.gitlabrunner.packages = [pkgs.bash pkgs.docker-machine pkgs.shadow pkgs.git];
nix.gc = {
automatic = true;
......@@ -70,47 +70,25 @@ let
users.extraUsers.root.openssh.authorizedKeys.keys = [ (pkgs.lib.readFile ./keys/id_buildfarm.pub)] ++ keys;
users.extraUsers.fre.openssh.authorizedKeys.keys = [ (pkgs.lib.readFile ./keys/id_buildfarm.pub)] ++ keys ;
};
mkBigChameleonRunner = ip: name: a@{...}:
((mkChameleonRunner ip name a)//
{
virtualisation.docker = {
enable = true;
};
#networking.firewall.enable = false;
#systemd.services."rkt-afl" = {
#description = "Airflow";
#wantedBy = [ "multi-user.target" ];
#serviceConfig = {
#Slice = "machine.slice";
#ExecStart = ''\
#${pkgs.rkt}/bin/rkt run --insecure-options=image \
#--port=8080-tcp:8080 \
#--volume=volume-root-airflow,kind=host,source=/var/airflow,readOnly=false \
#docker://puckel/docker-airflow \
#webserver
#'';
#KillMode = "mixed";
#Restart = "always";
#};
#};
});
in
{
network.description = "argo-ci";
network.enableRollback = false;
gitlab-runner-4 = mkChameleonRunner "129.114.111.114" "chameleon-129.114.111.114";
gitlab-runner-3 = mkChameleonRunner "129.114.110.3" "chameleon-129.114.110.3";
gitlab-runner-2 = mkChameleonRunner "129.114.111.116" "chameleon-129.114.111.116";
gitlab-runner-1 = mkChameleonRunner "129.114.33.201" "chameleon-129.114.33.201";
gitlab-runner-0 = mkBigChameleonRunner "129.114.111.64" "chameleon-129.114.111.64";
gitlab-runner-1 = mkChameleonRunner "129.114.111.64";
gitlab-runner-2 = mkChameleonRunner "129.114.111.114";
gitlab-runner-3 = mkChameleonRunner "129.114.110.214";
gitlab-runner-4 = mkChameleonRunner "129.114.110.3";
gitlab-runner-5 = mkChameleonRunner "129.114.33.201";
gitlab-runner-6 = mkChameleonRunner "129.114.111.83";
gitlab-runner-7 = mkChameleonRunner "129.114.111.116";
gitlab-runner-physical =
{ ... }:
let ip = "140.221.10.9"; in
{
deployment.targetEnv = "none";
deployment.targetHost = "140.221.10.9";
deployment.targetHost = ip;
environment.argo.singularity ={
enable = true;
......@@ -164,6 +142,7 @@ in
i18n.defaultLocale = "en_US.UTF-8";
nix.useSandbox = true;
nix.maxJobs = 5;
nix.nrBuildUsers = 30;
nix.trustedUsers=["root" "fre" ];
......@@ -174,9 +153,10 @@ in
virtualisation.docker.enable = true;
services.gitlab-runner2.enable = true;
services.gitlab-runner2.registrationConfigFile = "/run/gitlab.cfg";
services.gitlab-runner2.packages = [pkgs.bash pkgs.docker-machine pkgs.shadow pkgs.git];
services.gitlabrunner.name = "desktop-val-"+ip ;
services.gitlabrunner.enable = true;
services.gitlabrunner.registrationConfigFile = "/run/gitlab.cfg";
services.gitlabrunner.packages = [pkgs.bash pkgs.docker-machine pkgs.shadow pkgs.git];
nix.gc = {
automatic = true;
......
......@@ -5,10 +5,10 @@
{ config, pkgs, lib, ...}:
with lib;
let
cfg = config.services.gitlab-runner2;
cfg = config.services.gitlabrunner;
in
{
options.services.gitlab-runner2 = {
options.services.gitlabrunner = {
enable = lib.mkEnableOption "Gitlab Runner";
registrationConfigFile = lib.mkOption {
description = ''
......@@ -50,6 +50,13 @@ in
description = ''Time to wait until a graceful shutdown is turned into a forceful one.'';
};
concurrency = mkOption {
default = "1";
type = types.str;
example = "2";
description = ''Runner concurrency.'';
};
workDir = mkOption {
default = "/var/lib/gitlab-runner";
type = types.path;
......@@ -74,8 +81,8 @@ in
};
};
config = mkIf cfg.enable {
systemd.services.gitlab-runner2 = {
path = cfg.packages;
systemd.services.gitlabrunner = {
path = cfg.packages ++ [pkgs.gnused] ;
environment = config.networking.proxy.envVars;
description = "Gitlab Runner";
after = [ "network.target" "docker.service"];
......@@ -83,14 +90,17 @@ in
wantedBy = [ "multi-user.target" ];
serviceConfig = {
EnvironmentFile = "${cfg.registrationConfigFile}";
ExecStartPre = ''${cfg.package.bin}/bin/gitlab-runner register \
ExecStartPre = [''${cfg.package.bin}/bin/gitlab-runner register \
--non-interactive=true \
--name ${cfg.name} \
--executor "shell" \
--maximum-timeout 1800 \
--tag-list "integration,notknl"\
'';
ExecStart = ''${cfg.package.bin}/bin/gitlab-runner run \
--request-concurrency ${cfg.concurrency} \
--tag-list "integration,notknl,singularity"\
''
"${pkgs.gnused}/bin/sed -i 's/concurrent = 1/concurrent = ${cfg.concurrency}/' /etc/gitlab-runner/config.toml"];
ExecStart = ''
${cfg.package.bin}/bin/gitlab-runner run \
--working-directory ${cfg.workDir} \
--service gitlab-runner \
'';
......
#!/usr/bin/env bash
ssh-keygen -R 140.221.10.9
ssh-keygen -R 129.114.111.114
ssh-keygen -R 129.114.110.3
ssh-keygen -R 129.114.111.116
ssh-keygen -R 129.114.111.64
ssh-keygen -R 129.114.111.114
ssh-keygen -R 129.114.110.214
ssh-keygen -R 129.114.110.3
ssh-keygen -R 129.114.33.201
ssh-keygen -R 129.114.111.83
ssh-keygen -R 129.114.111.116
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment