mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-09-29 15:43:00 +00:00
nixos/modules/jenkins: Add option to add CLI
Signed-off-by: Pamplemousse <xav.maso@gmail.com>
This commit is contained in:
parent
6f6c649ec6
commit
4265efef54
@ -2,6 +2,7 @@
|
|||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.services.jenkins;
|
cfg = config.services.jenkins;
|
||||||
|
jenkinsUrl = "http://${cfg.listenAddress}:${toString cfg.port}${cfg.prefix}";
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
services.jenkins = {
|
services.jenkins = {
|
||||||
@ -141,14 +142,34 @@ in {
|
|||||||
Additional command line arguments to pass to the Java run time (as opposed to Jenkins).
|
Additional command line arguments to pass to the Java run time (as opposed to Jenkins).
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
withCLI = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to make the CLI available.
|
||||||
|
|
||||||
|
More info about the CLI available at
|
||||||
|
<link xlink:href="https://www.jenkins.io/doc/book/managing/cli">
|
||||||
|
https://www.jenkins.io/doc/book/managing/cli</link> .
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# server references the dejavu fonts
|
environment = {
|
||||||
environment.systemPackages = [
|
# server references the dejavu fonts
|
||||||
pkgs.dejavu_fonts
|
systemPackages = [
|
||||||
];
|
pkgs.dejavu_fonts
|
||||||
|
] ++ optional cfg.withCLI cfg.package;
|
||||||
|
|
||||||
|
variables = {}
|
||||||
|
// optionalAttrs cfg.withCLI {
|
||||||
|
# Make it more convenient to use the `jenkins-cli`.
|
||||||
|
JENKINS_URL = jenkinsUrl;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
users.groups = optionalAttrs (cfg.group == "jenkins") {
|
users.groups = optionalAttrs (cfg.group == "jenkins") {
|
||||||
jenkins.gid = config.ids.gids.jenkins;
|
jenkins.gid = config.ids.gids.jenkins;
|
||||||
@ -215,7 +236,7 @@ in {
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
postStart = ''
|
postStart = ''
|
||||||
until [[ $(${pkgs.curl.bin}/bin/curl -L -s --head -w '\n%{http_code}' http://${cfg.listenAddress}:${toString cfg.port}${cfg.prefix} | tail -n1) =~ ^(200|403)$ ]]; do
|
until [[ $(${pkgs.curl.bin}/bin/curl -L -s --head -w '\n%{http_code}' ${jenkinsUrl} | tail -n1) =~ ^(200|403)$ ]]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user