aboutsummaryrefslogtreecommitdiff
path: root/modules/apps
diff options
context:
space:
mode:
Diffstat (limited to 'modules/apps')
-rw-r--r--modules/apps/jenkins/default.nix15
-rw-r--r--modules/apps/jenkins/instance.nix9
2 files changed, 24 insertions, 0 deletions
diff --git a/modules/apps/jenkins/default.nix b/modules/apps/jenkins/default.nix
index 42ae197..210a4ea 100644
--- a/modules/apps/jenkins/default.nix
+++ b/modules/apps/jenkins/default.nix
@@ -26,6 +26,7 @@ let
configFiles = name: cfg: mapAttrs (n: v: maybeFile "jenkins-${name}-${n}" v) cfg.config;
jobFiles = name: cfg: mapAttrs (n: v: maybeFile "jenkins-${name}-job-${n}.xml" v) cfg.jobs;
+ nodeFiles = name: cfg: mapAttrs (n: v: maybeFile "jenkins-${name}-node-${n}.xml" v) cfg.nodes;
keyrings =
let
@@ -87,6 +88,20 @@ let
'') (jobFiles name cfg)
)}
+ if [ -d nodes ]; then
+ find nodes -maxdepth 1 -mindepth 1 -type d \
+ ${concatMapStringsSep " " (k: "-not -name '${escape [ "[" ] k}'") (attrNames cfg.nodes)} \
+ -print0 | xargs -0 --verbose --no-run-if-empty rm -rf
+ fi
+
+ ${concatStringsSep "\n" (
+ mapAttrsToList (n: p: ''
+ mkdir -p -- 'nodes/${n}'
+ rm -rf -- 'nodes/${n}/config.xml'
+ ${pkgs.libxml2}/bin/xmllint --xinclude --format '${p}' > 'nodes/${n}/config.xml'
+ '') (nodeFiles name cfg)
+ )}
+
mkdir -p secrets
echo ${if cfg.master-access-control then "false" else "true"} > secrets/slave-to-master-security-kill-switch
diff --git a/modules/apps/jenkins/instance.nix b/modules/apps/jenkins/instance.nix
index 6cca8a4..89c5c93 100644
--- a/modules/apps/jenkins/instance.nix
+++ b/modules/apps/jenkins/instance.nix
@@ -62,6 +62,15 @@ in {
default = true;
};
+ nodes = mkOption {
+ description = ''
+ Nodes. Each value is either inline XML text or an XML file.
+ Any existing nodes, not mentioned here, are physically removed.
+ '';
+ type = attrsOf (either str path);
+ default = {};
+ };
+
jobs = mkOption {
description = ''
Jenkins jobs. Each value is either inline XML text or an XML file.