From 8fb7706847abf856ec74874035817666e832dc6b Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Sat, 26 Jan 2019 18:06:38 -0500 Subject: [PATCH 1/3] hydra: 2018-08-07 -> 2019-02-01 --- pkgs/development/tools/misc/hydra/default.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgs/development/tools/misc/hydra/default.nix b/pkgs/development/tools/misc/hydra/default.nix index 42da07baca6..395ab5349c2 100644 --- a/pkgs/development/tools/misc/hydra/default.nix +++ b/pkgs/development/tools/misc/hydra/default.nix @@ -1,7 +1,7 @@ { stdenv, nix, perlPackages, buildEnv, releaseTools, fetchFromGitHub , makeWrapper, autoconf, automake, libtool, unzip, pkgconfig, sqlite, libpqxx , gitAndTools, mercurial, darcs, subversion, bazaar, openssl, bzip2, libxslt -, guile, perl, postgresql, nukeReferences, git, boehmgc +, guile, perl, postgresql, nukeReferences, git, boehmgc, nlohmann_json , docbook_xsl, openssh, gnused, coreutils, findutils, gzip, lzma, gnutar , rpm, dpkg, cdrkit, pixz, lib, fetchpatch, boost, autoreconfHook }: @@ -34,8 +34,8 @@ let CatalystViewDownload CatalystViewJSON CatalystViewTT - CatalystXRoleApplicator CatalystXScriptServerStarman + CatalystXRoleApplicator CryptRandPasswd DBDPg DBDSQLite @@ -71,15 +71,15 @@ let }; in releaseTools.nixBuild rec { name = "hydra-${version}"; - version = "2018-08-07"; + version = "2019-02-01"; inherit stdenv; src = fetchFromGitHub { owner = "NixOS"; repo = "hydra"; - rev = "4dca8fe14d3f782bdf927f37efce722acefffff3"; - sha256 = "1yas4psmvfp7lhcp81ia2sy93b78j9hiw9a6n3q2m1a616hwpm25"; + rev = "8b5948f4cf12424c04df67a6eb136c9846fb2cfd"; + sha256 = "0ldk3li394vykl9c4v9bs8pir05pmad24s0rx9bzqgz569zfj2iv"; }; buildInputs = @@ -88,6 +88,7 @@ in releaseTools.nixBuild rec { guile # optional, for Guile + Guix support perlDeps perl nix postgresql # for running the tests + nlohmann_json ] ++ lib.optionals isGreaterNix20 [ boost ]; hydraPath = lib.makeBinPath ( From acfc1c15352a88af7077af8581898a85f5935827 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 4 Feb 2019 23:56:39 +0100 Subject: [PATCH 2/3] hydra: don't support Nix 1.x The component `hydra-evaluator` requires `pool.hh` from Nix which isn't provided by Nix 1.x and thus fails with the following error in this case: ``` hydra-evaluator.cc:3:10: fatal error: pool.hh: No such file or directory #include "pool.hh" ^~~~~~~~~ compilation terminated. make[3]: *** [Makefile:443: hydra_evaluator-hydra-evaluator.o] Error 1 ``` As the commit is from 2016 and fairly hard to revert for Nix 1.x support, it's easier to drop that. This has been tested with fixed perl-bindings for Nix1 as done in #55146. --- pkgs/development/tools/misc/hydra/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/tools/misc/hydra/default.nix b/pkgs/development/tools/misc/hydra/default.nix index 395ab5349c2..00f679cfdac 100644 --- a/pkgs/development/tools/misc/hydra/default.nix +++ b/pkgs/development/tools/misc/hydra/default.nix @@ -8,6 +8,10 @@ with stdenv; +if lib.versions.major nix.version == "1" + then throw "This Hydra version doesn't support Nix 1.x" +else + let isGreaterNix20 = with lib.versions; let From 1649b4899fb90434310eee53e6183ec2410109f9 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 4 Feb 2019 23:58:20 +0100 Subject: [PATCH 3/3] nixos/hydra: enhance test for multiple Nix versions Hydra should support multiple Nix versions (and currently contains fixes to work with Nix 2.0 and higher). Further Nix versions can be added to the `hydraPkgs` expression in the test case which lists all supported Nix versions for Hydra. --- nixos/tests/hydra/default.nix | 138 +++++++++++++++++++--------------- 1 file changed, 76 insertions(+), 62 deletions(-) diff --git a/nixos/tests/hydra/default.nix b/nixos/tests/hydra/default.nix index db4e97e0039..882bced86d3 100644 --- a/nixos/tests/hydra/default.nix +++ b/nixos/tests/hydra/default.nix @@ -1,77 +1,91 @@ -import ../make-test.nix ({ pkgs, ...} : +{ system ? builtins.currentSystem +, config ? { } +, pkgs ? import ../../.. { inherit system config; } +}: let - trivialJob = pkgs.writeTextDir "trivial.nix" '' - { trivial = builtins.derivation { - name = "trivial"; - system = "x86_64-linux"; - builder = "/bin/sh"; - args = ["-c" "echo success > $out; exit 0"]; - }; - } - ''; - createTrivialProject = pkgs.stdenv.mkDerivation { - name = "create-trivial-project"; - unpackPhase = ":"; - buildInputs = [ pkgs.makeWrapper ]; - installPhase = "install -m755 -D ${./create-trivial-project.sh} $out/bin/create-trivial-project.sh"; - postFixup = '' - wrapProgram "$out/bin/create-trivial-project.sh" --prefix PATH ":" ${pkgs.stdenv.lib.makeBinPath [ pkgs.curl ]} --set EXPR_PATH ${trivialJob} - ''; - }; + trivialJob = pkgs.writeTextDir "trivial.nix" '' + { trivial = builtins.derivation { + name = "trivial"; + system = "x86_64-linux"; + builder = "/bin/sh"; + args = ["-c" "echo success > $out; exit 0"]; + }; + } + ''; -in { - name = "hydra-init-localdb"; - meta = with pkgs.stdenv.lib.maintainers; { - maintainers = [ pstn lewo ma27 ]; + createTrivialProject = pkgs.stdenv.mkDerivation { + name = "create-trivial-project"; + unpackPhase = ":"; + buildInputs = [ pkgs.makeWrapper ]; + installPhase = "install -m755 -D ${./create-trivial-project.sh} $out/bin/create-trivial-project.sh"; + postFixup = '' + wrapProgram "$out/bin/create-trivial-project.sh" --prefix PATH ":" ${pkgs.stdenv.lib.makeBinPath [ pkgs.curl ]} --set EXPR_PATH ${trivialJob} + ''; }; - machine = - { pkgs, ... }: + callTest = f: f { inherit system pkgs; }; - { - virtualisation.memorySize = 1024; - time.timeZone = "UTC"; + hydraPkgs = { + inherit (pkgs) nixStable nixUnstable; + }; - environment.systemPackages = [ createTrivialProject pkgs.jq ]; - services.hydra = { - enable = true; + tests = pkgs.lib.flip pkgs.lib.mapAttrs hydraPkgs (name: nix: + callTest (import ../make-test.nix ({ pkgs, lib, ... }: + { + name = "hydra-with-${name}"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ pstn lewo ma27 ]; + }; - #Hydra needs those settings to start up, so we add something not harmfull. - hydraURL = "example.com"; - notificationSender = "example@example.com"; - }; - nix = { - buildMachines = [{ - hostName = "localhost"; - systems = [ "x86_64-linux" ]; - }]; + machine = { pkgs, ... }: + { + virtualisation.memorySize = 1024; + time.timeZone = "UTC"; - binaryCaches = []; - }; - }; + environment.systemPackages = [ createTrivialProject pkgs.jq ]; + services.hydra = { + enable = true; - testScript = - '' - # let the system boot up - $machine->waitForUnit("multi-user.target"); - # test whether the database is running - $machine->succeed("systemctl status postgresql.service"); - # test whether the actual hydra daemons are running - $machine->succeed("systemctl status hydra-queue-runner.service"); - $machine->succeed("systemctl status hydra-init.service"); - $machine->succeed("systemctl status hydra-evaluator.service"); - $machine->succeed("systemctl status hydra-send-stats.service"); + #Hydra needs those settings to start up, so we add something not harmfull. + hydraURL = "example.com"; + notificationSender = "example@example.com"; - $machine->succeed("hydra-create-user admin --role admin --password admin"); + package = pkgs.hydra.override { inherit nix; }; + }; + nix = { + buildMachines = [{ + hostName = "localhost"; + systems = [ "x86_64-linux" ]; + }]; - # create a project with a trivial job - $machine->waitForOpenPort(3000); + binaryCaches = []; + }; + }; - # make sure the build as been successfully built - $machine->succeed("create-trivial-project.sh"); + testScript = '' + # let the system boot up + $machine->waitForUnit("multi-user.target"); + # test whether the database is running + $machine->succeed("systemctl status postgresql.service"); + # test whether the actual hydra daemons are running + $machine->succeed("systemctl status hydra-queue-runner.service"); + $machine->succeed("systemctl status hydra-init.service"); + $machine->succeed("systemctl status hydra-evaluator.service"); + $machine->succeed("systemctl status hydra-send-stats.service"); - $machine->waitUntilSucceeds('curl -L -s http://localhost:3000/build/1 -H "Accept: application/json" | jq .buildstatus | xargs test 0 -eq'); - ''; -}) + $machine->succeed("hydra-create-user admin --role admin --password admin"); + + # create a project with a trivial job + $machine->waitForOpenPort(3000); + + # make sure the build as been successfully built + $machine->succeed("create-trivial-project.sh"); + + $machine->waitUntilSucceeds('curl -L -s http://localhost:3000/build/1 -H "Accept: application/json" | jq .buildstatus | xargs test 0 -eq'); + ''; + }))); + +in + tests