mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
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;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.services.jenkinsSlave;
|
cfg = config.services.jenkinsSlave;
|
||||||
|
@ -46,6 +46,15 @@ in {
|
||||||
this is the home of the "jenkins" user.
|
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;
|
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.fail("systemctl is-enabled jenkins.service")
|
||||||
|
|
||||||
|
slave.succeed("java -fullversion")
|
||||||
|
|
||||||
with subtest("jobs are declarative"):
|
with subtest("jobs are declarative"):
|
||||||
# Check that jobs are created on disk.
|
# Check that jobs are created on disk.
|
||||||
master.wait_for_unit("jenkins-job-builder")
|
master.wait_for_unit("jenkins-job-builder")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue