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.
This commit is contained in:
parent
63f0c334f0
commit
eeb3206a29
2 changed files with 17 additions and 1 deletions
|
@ -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…
Reference in a new issue