nixos/jenkinsSlave: install java

Installs Java into the Jenkins agent and allows specifying the JDK/JRE package to use. This is necessary as Jenkins verifies if the agent contains Java installed through the java -fullversion command, which if not, the connection will fail.
main
P. R. d. O 2 years ago committed by Bjørn Forsman
parent 63f0c334f0
commit eeb3206a29
  1. 16
      nixos/modules/services/continuous-integration/jenkins/slave.nix
  2. 2
      nixos/tests/jenkins.nix

@ -1,4 +1,4 @@
{ config, lib, ... }:
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.jenkinsSlave;
@ -46,6 +46,15 @@ in {
this is the home of the "jenkins" user.
'';
};
javaPackage = mkOption {
default = pkgs.jdk;
defaultText = literalExpression "pkgs.jdk";
description = ''
Java package to install.
'';
type = types.package;
};
};
};
@ -64,5 +73,10 @@ in {
uid = config.ids.uids.jenkins;
};
};
programs.java = {
enable = true;
package = cfg.javaPackage;
};
};
}

@ -90,6 +90,8 @@ import ./make-test-python.nix ({ pkgs, ...} : {
slave.fail("systemctl is-enabled jenkins.service")
slave.succeed("java -fullversion")
with subtest("jobs are declarative"):
# Check that jobs are created on disk.
master.wait_for_unit("jenkins-job-builder")

Loading…
Cancel
Save