From 51e5beca4267d4138e9ac8babb744a65f8c4bed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Tue, 3 May 2016 22:08:57 +0200 Subject: [PATCH] jenkins service: remove unneeded (and brittle) part of postStart The current postStart code holds Jenkins off the "started" state until Jenkins becomes idle. But it should be enough to wait until Jenkins start handling HTTP requests to consider it "started". More reasons why the current approach is bad and we should remove it, from @coreyoconnor in https://github.com/NixOS/nixpkgs/issues/14991#issuecomment-216572571: 1. Repeatedly curling for a specific human-readable string to determine "Active" is fragile. For instance, what happens when jenkins is localized? 2. The time jenkins takes to initializes is variable. This (at least used to) depend on the number of jobs and any plugin upgrades requested. 3. Jenkins can be requested to restart from the UI. Which will not affect the status of the service. This means that the service being "active" does not imply jenkins is initialized. Downstream services cannot assume jenkins is initialized if the service is active. Might as well accept that and remove the initialized test from service startup. Fixes #14991. --- .../services/continuous-integration/jenkins/default.nix | 8 -------- 1 file changed, 8 deletions(-) diff --git a/nixos/modules/services/continuous-integration/jenkins/default.nix b/nixos/modules/services/continuous-integration/jenkins/default.nix index 6fd39e68b1d9..d30b27e9df4d 100644 --- a/nixos/modules/services/continuous-integration/jenkins/default.nix +++ b/nixos/modules/services/continuous-integration/jenkins/default.nix @@ -164,14 +164,6 @@ in { until ${pkgs.curl.bin}/bin/curl -s -L ${cfg.listenAddress}:${toString cfg.port}${cfg.prefix} ; do sleep 10 done - while true ; do - index=`${pkgs.curl.bin}/bin/curl -s -L ${cfg.listenAddress}:${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 - fi - sleep 30 - done ''; serviceConfig = {