diff options
author | Augustin Borsu <a.borsu@gmail.com> | 2015-12-23 09:19:18 +0100 |
---|---|---|
committer | Rok Garbas <rok@garbas.si> | 2015-12-23 11:38:57 +0100 |
commit | 44ea18499710049e165b475a98e04d02252d7533 (patch) | |
tree | 72387e90b1b066d47e4edf983c301b062a3dd337 /nixos/modules/services/continuous-integration/jenkins/default.nix | |
parent | bf9c16d4ace2ea853586c627660953d6a6ccb3dc (diff) | |
download | nixpkgs-44ea18499710049e165b475a98e04d02252d7533.tar nixpkgs-44ea18499710049e165b475a98e04d02252d7533.tar.gz nixpkgs-44ea18499710049e165b475a98e04d02252d7533.tar.bz2 nixpkgs-44ea18499710049e165b475a98e04d02252d7533.tar.lz nixpkgs-44ea18499710049e165b475a98e04d02252d7533.tar.xz nixpkgs-44ea18499710049e165b475a98e04d02252d7533.tar.zst nixpkgs-44ea18499710049e165b475a98e04d02252d7533.zip |
jenkins ci enhancement: add port and prefix option
As named these options enable to specify a bind host and url prefix to be used by jenkins. Adding these options in the config rather than using extra arguments allows us to re-use those information in other services using jenkins such as jenkins-job-builder or a reverse proxy.
Diffstat (limited to 'nixos/modules/services/continuous-integration/jenkins/default.nix')
-rw-r--r-- | nixos/modules/services/continuous-integration/jenkins/default.nix | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/nixos/modules/services/continuous-integration/jenkins/default.nix b/nixos/modules/services/continuous-integration/jenkins/default.nix index 9bd511ad3ae..3b76ada72bb 100644 --- a/nixos/modules/services/continuous-integration/jenkins/default.nix +++ b/nixos/modules/services/continuous-integration/jenkins/default.nix @@ -48,11 +48,33 @@ in { ''; }; + host = mkOption { + default = "0.0.0.0"; + example = "localhost"; + type = types.str; + description = '' + Specifies the bind adress on which the jenkins HTTP interface listens. + The default is the wildcard adress. + ''; + }; + port = mkOption { default = 8080; type = types.int; description = '' - Specifies port number on which the jenkins HTTP interface listens. The default is 8080. + Specifies port number on which the jenkins HTTP interface listens. + The default is 8080. + ''; + }; + + prefix = mkOption { + default = ""; + example = "/jenkins"; + type = types.str; + description = '' + Specifies a urlPrefix to use with jenkins. + If the example /jenkins is given, the jenkins server will be + accessible using localhost:8080/jenkins. ''; }; @@ -80,7 +102,7 @@ in { extraOptions = mkOption { type = types.listOf types.str; default = [ ]; - example = [ "--debug=9" "--httpListenAddress=localhost" ]; + example = [ "--debug=9" ]; description = '' Additional command line arguments to pass to Jenkins. ''; @@ -134,15 +156,18 @@ in { ''; script = '' - ${pkgs.jdk}/bin/java -jar ${pkgs.jenkins} --httpPort=${toString cfg.port} ${concatStringsSep " " cfg.extraOptions} + ${pkgs.jdk}/bin/java -jar ${pkgs.jenkins} --httpListenAddress=${cfg.host} \ + --httpPort=${toString cfg.port} \ + --prefix=${cfg.prefix} \ + ${concatStringsSep " " cfg.extraOptions} ''; postStart = '' - until ${pkgs.curl}/bin/curl -s -L localhost:${toString cfg.port} ; do + until ${pkgs.curl}/bin/curl -s -L ${cfg.host}:${toString cfg.port}${cfg.prefix} ; do sleep 10 done while true ; do - index=`${pkgs.curl}/bin/curl -s -L localhost:${toString cfg.port}` + index=`${pkgs.curl}/bin/curl -s -L ${cfg.host}:${toString cfg.port}${cfg.prefix}` if [[ !("$index" =~ 'Please wait while Jenkins is restarting' || "$index" =~ 'Please wait while Jenkins is getting ready to work') ]]; then exit 0 |