Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

Merge pull request #55101 from lopsided98/hydra-update

hydra: 2018-08-07 -> 2019-02-01

authored by

lewo and committed by
GitHub
15e43d59 fec445d9

+86 -67
+76 -62
nixos/tests/hydra/default.nix
··· 1 - import ../make-test.nix ({ pkgs, ...} : 1 + { system ? builtins.currentSystem 2 + , config ? { } 3 + , pkgs ? import ../../.. { inherit system config; } 4 + }: 2 5 3 6 let 4 - trivialJob = pkgs.writeTextDir "trivial.nix" '' 5 - { trivial = builtins.derivation { 6 - name = "trivial"; 7 - system = "x86_64-linux"; 8 - builder = "/bin/sh"; 9 - args = ["-c" "echo success > $out; exit 0"]; 10 - }; 11 - } 12 - ''; 13 7 14 - createTrivialProject = pkgs.stdenv.mkDerivation { 15 - name = "create-trivial-project"; 16 - unpackPhase = ":"; 17 - buildInputs = [ pkgs.makeWrapper ]; 18 - installPhase = "install -m755 -D ${./create-trivial-project.sh} $out/bin/create-trivial-project.sh"; 19 - postFixup = '' 20 - wrapProgram "$out/bin/create-trivial-project.sh" --prefix PATH ":" ${pkgs.stdenv.lib.makeBinPath [ pkgs.curl ]} --set EXPR_PATH ${trivialJob} 21 - ''; 22 - }; 8 + trivialJob = pkgs.writeTextDir "trivial.nix" '' 9 + { trivial = builtins.derivation { 10 + name = "trivial"; 11 + system = "x86_64-linux"; 12 + builder = "/bin/sh"; 13 + args = ["-c" "echo success > $out; exit 0"]; 14 + }; 15 + } 16 + ''; 23 17 24 - in { 25 - name = "hydra-init-localdb"; 26 - meta = with pkgs.stdenv.lib.maintainers; { 27 - maintainers = [ pstn lewo ma27 ]; 18 + createTrivialProject = pkgs.stdenv.mkDerivation { 19 + name = "create-trivial-project"; 20 + unpackPhase = ":"; 21 + buildInputs = [ pkgs.makeWrapper ]; 22 + installPhase = "install -m755 -D ${./create-trivial-project.sh} $out/bin/create-trivial-project.sh"; 23 + postFixup = '' 24 + wrapProgram "$out/bin/create-trivial-project.sh" --prefix PATH ":" ${pkgs.stdenv.lib.makeBinPath [ pkgs.curl ]} --set EXPR_PATH ${trivialJob} 25 + ''; 28 26 }; 29 27 30 - machine = 31 - { pkgs, ... }: 28 + callTest = f: f { inherit system pkgs; }; 32 29 33 - { 34 - virtualisation.memorySize = 1024; 35 - time.timeZone = "UTC"; 30 + hydraPkgs = { 31 + inherit (pkgs) nixStable nixUnstable; 32 + }; 36 33 37 - environment.systemPackages = [ createTrivialProject pkgs.jq ]; 38 - services.hydra = { 39 - enable = true; 34 + tests = pkgs.lib.flip pkgs.lib.mapAttrs hydraPkgs (name: nix: 35 + callTest (import ../make-test.nix ({ pkgs, lib, ... }: 36 + { 37 + name = "hydra-with-${name}"; 38 + meta = with pkgs.stdenv.lib.maintainers; { 39 + maintainers = [ pstn lewo ma27 ]; 40 + }; 40 41 41 - #Hydra needs those settings to start up, so we add something not harmfull. 42 - hydraURL = "example.com"; 43 - notificationSender = "example@example.com"; 44 - }; 45 - nix = { 46 - buildMachines = [{ 47 - hostName = "localhost"; 48 - systems = [ "x86_64-linux" ]; 49 - }]; 42 + machine = { pkgs, ... }: 43 + { 44 + virtualisation.memorySize = 1024; 45 + time.timeZone = "UTC"; 46 + 47 + environment.systemPackages = [ createTrivialProject pkgs.jq ]; 48 + services.hydra = { 49 + enable = true; 50 + 51 + #Hydra needs those settings to start up, so we add something not harmfull. 52 + hydraURL = "example.com"; 53 + notificationSender = "example@example.com"; 54 + 55 + package = pkgs.hydra.override { inherit nix; }; 56 + }; 57 + nix = { 58 + buildMachines = [{ 59 + hostName = "localhost"; 60 + systems = [ "x86_64-linux" ]; 61 + }]; 62 + 63 + binaryCaches = []; 64 + }; 65 + }; 50 66 51 - binaryCaches = []; 52 - }; 53 - }; 67 + testScript = '' 68 + # let the system boot up 69 + $machine->waitForUnit("multi-user.target"); 70 + # test whether the database is running 71 + $machine->succeed("systemctl status postgresql.service"); 72 + # test whether the actual hydra daemons are running 73 + $machine->succeed("systemctl status hydra-queue-runner.service"); 74 + $machine->succeed("systemctl status hydra-init.service"); 75 + $machine->succeed("systemctl status hydra-evaluator.service"); 76 + $machine->succeed("systemctl status hydra-send-stats.service"); 54 77 55 - testScript = 56 - '' 57 - # let the system boot up 58 - $machine->waitForUnit("multi-user.target"); 59 - # test whether the database is running 60 - $machine->succeed("systemctl status postgresql.service"); 61 - # test whether the actual hydra daemons are running 62 - $machine->succeed("systemctl status hydra-queue-runner.service"); 63 - $machine->succeed("systemctl status hydra-init.service"); 64 - $machine->succeed("systemctl status hydra-evaluator.service"); 65 - $machine->succeed("systemctl status hydra-send-stats.service"); 78 + $machine->succeed("hydra-create-user admin --role admin --password admin"); 66 79 67 - $machine->succeed("hydra-create-user admin --role admin --password admin"); 80 + # create a project with a trivial job 81 + $machine->waitForOpenPort(3000); 68 82 69 - # create a project with a trivial job 70 - $machine->waitForOpenPort(3000); 83 + # make sure the build as been successfully built 84 + $machine->succeed("create-trivial-project.sh"); 71 85 72 - # make sure the build as been successfully built 73 - $machine->succeed("create-trivial-project.sh"); 86 + $machine->waitUntilSucceeds('curl -L -s http://localhost:3000/build/1 -H "Accept: application/json" | jq .buildstatus | xargs test 0 -eq'); 87 + ''; 88 + }))); 74 89 75 - $machine->waitUntilSucceeds('curl -L -s http://localhost:3000/build/1 -H "Accept: application/json" | jq .buildstatus | xargs test 0 -eq'); 76 - ''; 77 - }) 90 + in 91 + tests
+10 -5
pkgs/development/tools/misc/hydra/default.nix
··· 1 1 { stdenv, nix, perlPackages, buildEnv, releaseTools, fetchFromGitHub 2 2 , makeWrapper, autoconf, automake, libtool, unzip, pkgconfig, sqlite, libpqxx 3 3 , gitAndTools, mercurial, darcs, subversion, bazaar, openssl, bzip2, libxslt 4 - , guile, perl, postgresql, nukeReferences, git, boehmgc 4 + , guile, perl, postgresql, nukeReferences, git, boehmgc, nlohmann_json 5 5 , docbook_xsl, openssh, gnused, coreutils, findutils, gzip, lzma, gnutar 6 6 , rpm, dpkg, cdrkit, pixz, lib, fetchpatch, boost, autoreconfHook 7 7 }: 8 8 9 9 with stdenv; 10 + 11 + if lib.versions.major nix.version == "1" 12 + then throw "This Hydra version doesn't support Nix 1.x" 13 + else 10 14 11 15 let 12 16 isGreaterNix20 = with lib.versions; ··· 34 38 CatalystViewDownload 35 39 CatalystViewJSON 36 40 CatalystViewTT 37 - CatalystXRoleApplicator 38 41 CatalystXScriptServerStarman 42 + CatalystXRoleApplicator 39 43 CryptRandPasswd 40 44 DBDPg 41 45 DBDSQLite ··· 71 75 }; 72 76 in releaseTools.nixBuild rec { 73 77 name = "hydra-${version}"; 74 - version = "2018-08-07"; 78 + version = "2019-02-01"; 75 79 76 80 inherit stdenv; 77 81 78 82 src = fetchFromGitHub { 79 83 owner = "NixOS"; 80 84 repo = "hydra"; 81 - rev = "4dca8fe14d3f782bdf927f37efce722acefffff3"; 82 - sha256 = "1yas4psmvfp7lhcp81ia2sy93b78j9hiw9a6n3q2m1a616hwpm25"; 85 + rev = "8b5948f4cf12424c04df67a6eb136c9846fb2cfd"; 86 + sha256 = "0ldk3li394vykl9c4v9bs8pir05pmad24s0rx9bzqgz569zfj2iv"; 83 87 }; 84 88 85 89 buildInputs = ··· 88 92 guile # optional, for Guile + Guix support 89 93 perlDeps perl nix 90 94 postgresql # for running the tests 95 + nlohmann_json 91 96 ] ++ lib.optionals isGreaterNix20 [ boost ]; 92 97 93 98 hydraPath = lib.makeBinPath (