From f7151209c413d0ba51d2986e9e942eb37610b06c Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 19 Aug 2023 16:27:05 +0100 Subject: [PATCH 1/4] nixos/woodpecker-agents: fix 'podman' example The name should match the fact that we're using `podman` instead of `docker`. And the group was wrong. --- .../services/continuous-integration/woodpecker/agents.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/continuous-integration/woodpecker/agents.nix b/nixos/modules/services/continuous-integration/woodpecker/agents.nix index cc5b903afd59..fb86e854d294 100644 --- a/nixos/modules/services/continuous-integration/woodpecker/agents.nix +++ b/nixos/modules/services/continuous-integration/woodpecker/agents.nix @@ -107,14 +107,14 @@ in default = { }; type = lib.types.attrsOf agentModule; example = { - docker = { + podman = { environment = { WOODPECKER_SERVER = "localhost:9000"; WOODPECKER_BACKEND = "docker"; DOCKER_HOST = "unix:///run/podman/podman.sock"; }; - extraGroups = [ "docker" ]; + extraGroups = [ "podman" ]; environmentFile = "/run/secrets/woodpecker/agent-secret.txt"; }; From 7d246a2873ea045ce7b2381f72a76f701f5abbd9 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 18 Aug 2023 13:32:59 +0000 Subject: [PATCH 2/4] nixos/woodpecker-agents: fix typos in doc The name of the backend is `local`, not `exec`. `environmentFile` is supposed to be a list. --- .../services/continuous-integration/woodpecker/agents.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/continuous-integration/woodpecker/agents.nix b/nixos/modules/services/continuous-integration/woodpecker/agents.nix index fb86e854d294..62719ee934af 100644 --- a/nixos/modules/services/continuous-integration/woodpecker/agents.nix +++ b/nixos/modules/services/continuous-integration/woodpecker/agents.nix @@ -116,16 +116,16 @@ in extraGroups = [ "podman" ]; - environmentFile = "/run/secrets/woodpecker/agent-secret.txt"; + environmentFile = [ "/run/secrets/woodpecker/agent-secret.txt" ]; }; exec = { environment = { WOODPECKER_SERVER = "localhost:9000"; - WOODPECKER_BACKEND = "exec"; + WOODPECKER_BACKEND = "local"; }; - environmentFile = "/run/secrets/woodpecker/agent-secret.txt"; + environmentFile = [ "/run/secrets/woodpecker/agent-secret.txt" ]; }; }; description = lib.mdDoc "woodpecker-agents configurations"; From 6dd4c5f73faae32bea4bed2cf8f1a98328387129 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Sat, 19 Aug 2023 16:29:08 +0100 Subject: [PATCH 3/4] nixos/woodpecker-agents: use 'literalExample' The next commit is going to add an option which takes a list of packages. So the example must be converted to make it documentable. This will also allow adding comments, to explain why some options are used. --- .../woodpecker/agents.nix | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/nixos/modules/services/continuous-integration/woodpecker/agents.nix b/nixos/modules/services/continuous-integration/woodpecker/agents.nix index 62719ee934af..4beb74ca5b39 100644 --- a/nixos/modules/services/continuous-integration/woodpecker/agents.nix +++ b/nixos/modules/services/continuous-integration/woodpecker/agents.nix @@ -106,28 +106,30 @@ in agents = lib.mkOption { default = { }; type = lib.types.attrsOf agentModule; - example = { - podman = { - environment = { - WOODPECKER_SERVER = "localhost:9000"; - WOODPECKER_BACKEND = "docker"; - DOCKER_HOST = "unix:///run/podman/podman.sock"; + example = lib.literalExpression '' + { + podman = { + environment = { + WOODPECKER_SERVER = "localhost:9000"; + WOODPECKER_BACKEND = "docker"; + DOCKER_HOST = "unix:///run/podman/podman.sock"; + }; + + extraGroups = [ "podman" ]; + + environmentFile = [ "/run/secrets/woodpecker/agent-secret.txt" ]; }; - extraGroups = [ "podman" ]; + exec = { + environment = { + WOODPECKER_SERVER = "localhost:9000"; + WOODPECKER_BACKEND = "local"; + }; - environmentFile = [ "/run/secrets/woodpecker/agent-secret.txt" ]; - }; - - exec = { - environment = { - WOODPECKER_SERVER = "localhost:9000"; - WOODPECKER_BACKEND = "local"; + environmentFile = [ "/run/secrets/woodpecker/agent-secret.txt" ]; }; - - environmentFile = [ "/run/secrets/woodpecker/agent-secret.txt" ]; - }; - }; + } + ''; description = lib.mdDoc "woodpecker-agents configurations"; }; }; From 200c3bad4254b41202d8e96959c19e15a20c6434 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 18 Aug 2023 13:39:08 +0000 Subject: [PATCH 4/4] nixos/woodpecker-agents: add 'path' option See #249602. --- .../woodpecker/agents.nix | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/continuous-integration/woodpecker/agents.nix b/nixos/modules/services/continuous-integration/woodpecker/agents.nix index 4beb74ca5b39..3b883c72ff07 100644 --- a/nixos/modules/services/continuous-integration/woodpecker/agents.nix +++ b/nixos/modules/services/continuous-integration/woodpecker/agents.nix @@ -35,6 +35,16 @@ let ''; }; + path = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = [ ]; + example = [ "" ]; + description = lib.mdDoc '' + Additional packages that should be added to the agent's `PATH`. + Mostly useful for the `local` backend. + ''; + }; + environmentFile = lib.mkOption { type = lib.types.listOf lib.types.path; default = [ ]; @@ -94,7 +104,7 @@ let "-/etc/localtime" ]; }; - inherit (agentCfg) environment; + inherit (agentCfg) environment path; }; }; in @@ -127,6 +137,17 @@ in }; environmentFile = [ "/run/secrets/woodpecker/agent-secret.txt" ]; + + path = [ + # Needed to clone repos + git + git-lfs + woodpecker-plugin-git + # Used by the runner as the default shell + bash + # Most likely to be used in pipeline definitions + coreutils + ]; }; } '';