nixos/jenkins-job-builder: set serviceConfig.Type = "oneshot"

This change allows detecting configuration errors during
switch-to-configuration instead of them being reported asynchronously
*after* switch-to-configuration has exited.

(And update the NixOS test accordingly.)
This commit is contained in:
Bjørn Forsman 2022-07-18 10:17:40 +02:00
parent 57d8154c4e
commit 16108ff74a
2 changed files with 2 additions and 5 deletions

View File

@ -243,6 +243,7 @@ in {
done
'' + (if cfg.accessUser != "" then reloadScript else "");
serviceConfig = {
Type = "oneshot";
User = jenkinsCfg.user;
RuntimeDirectory = "jenkins-job-builder";
};

View File

@ -81,7 +81,7 @@ import ./make-test-python.nix ({ pkgs, ...} : {
in ''
start_all()
master.wait_for_unit("jenkins")
master.wait_for_unit("default.target")
assert "Authentication required" in master.succeed("curl http://localhost:8080")
@ -96,8 +96,6 @@ import ./make-test-python.nix ({ pkgs, ...} : {
with subtest("jobs are declarative"):
# Check that jobs are created on disk.
master.wait_for_unit("jenkins-job-builder")
master.wait_until_fails("systemctl is-active jenkins-job-builder")
master.wait_until_succeeds("test -f /var/lib/jenkins/jobs/job-1/config.xml")
master.wait_until_succeeds("test -f /var/lib/jenkins/jobs/folder-1/config.xml")
master.wait_until_succeeds("test -f /var/lib/jenkins/jobs/folder-1/jobs/job-2/config.xml")
@ -115,8 +113,6 @@ import ./make-test-python.nix ({ pkgs, ...} : {
)
# Check that jobs are removed from disk.
master.wait_for_unit("jenkins-job-builder")
master.wait_until_fails("systemctl is-active jenkins-job-builder")
master.wait_until_fails("test -f /var/lib/jenkins/jobs/job-1/config.xml")
master.wait_until_fails("test -f /var/lib/jenkins/jobs/folder-1/config.xml")
master.wait_until_fails("test -f /var/lib/jenkins/jobs/folder-1/jobs/job-2/config.xml")