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KHNYV6GFIQC Y2BFYLLKUGX3D6MKZXYMLPBPQFD4UGI4L3HK5ETYQBQVQCAQBIIQC HAJZXVXRXW6D27BJCYCTBNJMB7MZ3VIVQFY6IVCPIA4BJUM7VXBQC 4Y2EDQEGDQBHWK2NN3KSKQBG3A6AJD5MBL466V6GDRPSKJUBDHCAC 7XOH2DGH3W4B7BJWCXDP673R5R7TQGLCNTHJT7IZUSBVQWYWJUHQC ZYEFL36QOB6KUR276RRT4PSAK7HWUJ6TLLZBEZM7SSGUX2WQTMZQC D3MDJONYWWNXVVZDKTPDQE2H2HGMF263LXKT57B2GYCOXNM3PPOQC TTZ26BJQKIASUK7MT6KGQOIOOHEYWNV4UASO2ZQWGK4ADGK6SR6QC { hydraSrc ? builtins.fetchGit ./., nixpkgs ? builtins.fetchGit { url = https://github.com/NixOS/nixpkgs-channels.git; ref = "nixos-19.03-small"; }, officialRelease ? false}:letgenAttrs' = genAttrs [ "x86_64-linux" /* "i686-linux" */ ];hydraServer = hydraPkg:{ config, pkgs, ... }:{ imports = [ ./hydra-module.nix ];virtualisation.memorySize = 1024;services.hydra-dev.enable = true;services.hydra-dev.package = hydraPkg;services.hydra-dev.hydraURL = "http://hydra.example.org";services.hydra-dev.notificationSender = "admin@hydra.example.org";services.postgresql.enable = true;services.postgresql.package = pkgs.postgresql95;environment.systemPackages = [ pkgs.perlPackages.LWP pkgs.perlPackages.JSON ];};# FIXME: use commit date.version = builtins.readFile ./version + "." + toString hydraSrc.revCount or 0 + "." + hydraSrc.shortRev or "0000000";inrec {build = genAttrs' (system:let pkgs = import nixpkgs { inherit system; }; inletperlDeps = buildEnv {name = "hydra-perl-deps";paths = with perlPackages;[ ModulePluggableCatalystActionRESTCatalystAuthenticationStoreDBIxClassCatalystDevelCatalystDispatchTypeRegexCatalystPluginAccessLogCatalystPluginAuthorizationRolesCatalystPluginCaptchaCatalystPluginSessionStateCookieCatalystPluginSessionStoreFastMmapCatalystPluginStackTraceCatalystPluginUnicodeEncodingCatalystTraitForRequestProxyBaseCatalystViewDownloadCatalystViewJSONCatalystViewTTCatalystXScriptServerStarmanCryptRandPasswdDBDPgDBDSQLiteDataDumpDateTimeDigestSHA1EmailMIMEEmailSenderFileSlurpIOCompressIPCRunJSONXSLWPLWPProtocolHttpsNetAmazonS3NetStatsdPadWalkerReadonlySQLSplitStatementSetScalarStarmanSysHostnameLongTestMoreTextDiffTextTableXMLSimplenixnix.perl-bindingsgitboehmgc];};inreleaseTools.nixBuild {name = "hydra-${version}";src = if shell then null else hydraSrc;buildInputs =[ makeWrapper autoconf automake libtool unzip nukeReferences pkgconfig sqlite libpqxxgitAndTools.topGit mercurial darcs subversion bazaar openssl bzip2 libxsltguile # optional, for Guile + Guix supportperlDeps perl nixpostgresql95 # for running the testsboostnlohmann_json];hydraPath = lib.makeBinPath ([ sqlite subversion openssh nix coreutils findutils pixzgzip bzip2 lzma gnutar unzip git gitAndTools.topGit mercurial darcs gnused bazaar] ++ lib.optionals stdenv.isLinux [ rpm dpkg cdrkit ] );postUnpack = optionalString (!shell) ''# Clean up when building from a working tree.(cd $sourceRoot && (git ls-files -o --directory | xargs -r rm -rfv)) || true'';configureFlags = [ "--with-docbook-xsl=${docbook_xsl}/xml/xsl/docbook" ];shellHook = ''PATH=$(pwd)/src/hydra-evaluator:$(pwd)/src/script:$(pwd)/src/hydra-eval-jobs:$(pwd)/src/hydra-queue-runner:$PATH${lib.optionalString shell "PERL5LIB=$(pwd)/src/lib:$PERL5LIB"}'';preConfigure = "autoreconf -vfi";enableParallelBuilding = true;preCheck = ''patchShebangs .export LOGNAME=''${LOGNAME:-foo}'';postInstall = ''mkdir -p $out/nix-supportfor i in $out/bin/*; doread -n 4 chars < $iif [[ $chars =~ ELF ]]; then continue; fiwrapProgram $i \--prefix PERL5LIB ':' $out/libexec/hydra/lib:$PERL5LIB \--prefix PATH ':' $out/bin:$hydraPath \--set HYDRA_RELEASE ${version} \--set HYDRA_HOME $out/libexec/hydra \--set NIX_RELEASE ${nix.name or "unknown"}done''; # */dontStrip = true;meta.description = "Build of Hydra on ${system}";passthru.perlDeps = perlDeps;});manual = pkgs.runCommand "hydra-manual-${version}"{ build = build.x86_64-linux;}''mkdir -p $out/sharecp -prvd $build/share/doc $out/share/mkdir $out/nix-supportecho "doc manual $out/share/doc/hydra" >> $out/nix-support/hydra-build-products'';tests.install = genAttrs' (system:with import (nixpkgs + "/nixos/lib/testing.nix") { inherit system; };simpleTest {machine = hydraServer build.${system};testScript =''$machine->waitForJob("hydra-init");$machine->waitForJob("hydra-server");$machine->waitForJob("hydra-evaluator");$machine->waitForJob("hydra-queue-runner");$machine->waitForOpenPort("3000");'';});tests.api = genAttrs' (system:with import (nixpkgs + "/nixos/lib/testing.nix") { inherit system; };simpleTest {machine = hydraServer build.${system};testScript =''$machine->waitForJob("hydra-init");# Create an admin account and some other state.$machine->succeed( "su - hydra -c \"hydra-create-user root --email-address 'alice\@example.org' --password foobar --role admin\"", "mkdir /run/jobset /tmp/nix", "chmod 755 /run/jobset /tmp/nix", "cp ${./tests/api-test.nix} /run/jobset/default.nix", "chmod 644 /run/jobset/default.nix", "chown -R hydra /run/jobset /tmp/nix");$machine->succeed("systemctl stop hydra-evaluator hydra-queue-runner");$machine->waitForJob("hydra-server");$machine->waitForOpenPort("3000");# Run the API tests.$machine->mustSucceed("su - hydra -c 'perl -I ${build.${system}.perlDeps}/lib/perl5/site_perl ${./tests/api-test.pl}' >&2");'';});tests.notifications = genAttrs' (system:with import (nixpkgs + "/nixos/lib/testing.nix") { inherit system; };simpleTest {machine = { pkgs, ... }: {imports = [ (hydraServer build.${system}) ];services.hydra-dev.extraConfig = ''<influxdb>url = http://127.0.0.1:8086db = hydra</influxdb>'';});tests.s3backup = genAttrs' (system:with import (nixpkgs + "/nixos/lib/testing.nix") { inherit system; };let hydra = build.${system}simpleTest {machine ={ config, pkgs, ... }:{ services.postgresql.enable = true;services.postgresql.package = pkgs.postgresql95;environment.systemPackages = [ hydra pkgs.rubyLibs.fakes3 ];virtualisation.memorySize = 2047;boot.kernelPackages = pkgs.linuxPackages_3_10;virtualisation.writableStore = true;networking.extraHosts = ''127.0.0.1 hydra.s3.amazonaws.com'';};testScript =''$machine->waitForJob("postgresql");# Initialise the database and the state.$machine->succeed( "createdb -O root hydra", "psql hydra -f ${hydra}/libexec/hydra/sql/hydra-postgresql.sql", "mkdir /var/lib/hydra", "mkdir /tmp/jobs", "cp ${./tests/s3-backup-test.pl} /tmp/s3-backup-test.pl", "cp ${./tests/api-test.nix} /tmp/jobs/default.nix");# start fakes3$machine->succeed("fakes3 --root /tmp/s3 --port 80 &>/dev/null &");$machine->waitForOpenPort("80");$machine->succeed("cd /tmp && LOGNAME=root AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar HYDRA_DBI='dbi:Pg:dbname=hydra;user=root;' HYDRA_CONFIG=${./tests/s3-backup-test.config} perl -I ${hydra}/libexec/hydra/lib -I ${hydra.perlDeps}/lib/perl5/site_perl ./s3-backup-test.pl >&2");'';});*//*services.influxdb.enable = true;};testScript = ''$machine->waitForJob("hydra-init");# Create an admin account and some other state.$machine->succeed( "su - hydra -c \"hydra-create-user root --email-address 'alice\@example.org' --password foobar --role admin\"", "mkdir /run/jobset", "chmod 755 /run/jobset", "cp ${./tests/api-test.nix} /run/jobset/default.nix", "chmod 644 /run/jobset/default.nix", "chown -R hydra /run/jobset");# Wait until InfluxDB can receive web requests$machine->waitForJob("influxdb");$machine->waitForOpenPort("8086");# Create an InfluxDB database where hydra will write to$machine->succeed("curl -XPOST 'http://127.0.0.1:8086/query' \\--data-urlencode 'q=CREATE DATABASE hydra'");# Wait until hydra-server can receive HTTP requests$machine->waitForJob("hydra-server");$machine->waitForOpenPort("3000");# Setup the project and jobset$machine->mustSucceed("su - hydra -c 'perl -I ${build.${system}.perlDeps}/lib/perl5/site_perl ${./tests/setup-notifications-jobset.pl}' >&2");# Wait until hydra has build the job and# the InfluxDBNotification plugin uploaded its notification to InfluxDB$machine->waitUntilSucceeds("curl -s -H 'Accept: application/csv' \\-G 'http://127.0.0.1:8086/query?db=hydra' \\--data-urlencode 'q=SELECT * FROM hydra_build_status' | grep success");'';let dbi = "dbi:Pg:dbname=hydra;user=root;"; in}$machine->succeed("curl --fail http://localhost:3000/");NIX_LDFLAGS = [ "-lpthread" ];JSONJSONAnyCatalystXRoleApplicatorwith pkgs;# The following is to work around the following error from hydra-server:# [error] Caught exception in engine "Cannot determine local time zone"time.timeZone = "UTC";nix = {# The following is to work around: https://github.com/NixOS/hydra/pull/432buildMachines = [{ hostName = "localhost";system = "x86_64-linux";}];# Without this nix tries to fetch packages from the default# cache.nixos.org which is not reachable from this sandboxed NixOS test.binaryCaches = [];};virtualisation.writableStore = true;with pkgs.lib;, shell ? false, pkgs ? import nixpkgs { system = "x86_64-linux"; }, nix ? pkgs.nixUnstable or pkgs.nix
nix = inputs.nix.hydraJobs.build.x86_64-linux // {perl-bindings = inputs.nix.hydraJobs.perlBindings.x86_64-linux;
version = "${builtins.readFile ./version}.${builtins.substring 0 8 self.lastModified}.${self.shortRev}";# FIXME: use nix overlay?nix' = nix.hydraJobs.build.x86_64-linux // {perl-bindings = nix.hydraJobs.perlBindings.x86_64-linux;};pkgs = import nixpkgs {system = "x86_64-linux";overlays = [ self.overlay ];
# NixOS configuration used for VM tests.hydraServer ={ config, pkgs, ... }:{ imports = [ self.nixosModules.hydra ];virtualisation.memorySize = 1024;virtualisation.writableStore = true;services.hydra-dev.enable = true;services.hydra-dev.hydraURL = "http://hydra.example.org";services.hydra-dev.notificationSender = "admin@hydra.example.org";services.postgresql.enable = true;services.postgresql.package = pkgs.postgresql95;environment.systemPackages = [ pkgs.perlPackages.LWP pkgs.perlPackages.JSON ];# The following is to work around the following error from hydra-server:# [error] Caught exception in engine "Cannot determine local time zone"time.timeZone = "UTC";nix = {# The following is to work around: https://github.com/NixOS/hydra/pull/432buildMachines = [{ hostName = "localhost";system = "x86_64-linux";}];# Without this nix tries to fetch packages from the default# cache.nixos.org which is not reachable from this sandboxed NixOS test.binaryCaches = [];};};
hydraJobs = import ./release.nix {hydraSrc = self;nixpkgs = nixpkgs;inherit nix;
# A Nixpkgs overlay that provides a 'hydra' package.overlay = final: prev: {hydra = with final; letperlDeps = buildEnv {name = "hydra-perl-deps";paths = with perlPackages;[ ModulePluggableCatalystActionRESTCatalystAuthenticationStoreDBIxClassCatalystDevelCatalystDispatchTypeRegexCatalystPluginAccessLogCatalystPluginAuthorizationRolesCatalystPluginCaptchaCatalystPluginSessionStateCookieCatalystPluginSessionStoreFastMmapCatalystPluginStackTraceCatalystPluginUnicodeEncodingCatalystTraitForRequestProxyBaseCatalystViewDownloadCatalystViewJSONCatalystViewTTCatalystXScriptServerStarmanCatalystXRoleApplicatorCryptRandPasswdDBDPgDBDSQLiteDataDumpDateTimeDigestSHA1EmailMIMEEmailSenderFileSlurpIOCompressIPCRunJSONJSONAnyJSONXSLWPLWPProtocolHttpsNetAmazonS3NetStatsdPadWalkerReadonlySQLSplitStatementSetScalarStarmanSysHostnameLongTestMoreTextDiffTextTableXMLSimplenix'nix'.perl-bindingsgitboehmgc];};in stdenv.mkDerivation {name = "hydra-${version}";src = self;buildInputs =[ makeWrapper autoconf automake libtool unzip nukeReferences pkgconfig sqlite libpqxxgitAndTools.topGit mercurial darcs subversion bazaar openssl bzip2 libxsltguile # optional, for Guile + Guix supportperlDeps perl nix'postgresql95 # for running the testsboostnlohmann_json];hydraPath = lib.makeBinPath ([ sqlite subversion openssh nix' coreutils findutils pixzgzip bzip2 lzma gnutar unzip git gitAndTools.topGit mercurial darcs gnused bazaar] ++ lib.optionals stdenv.isLinux [ rpm dpkg cdrkit ] );configureFlags = [ "--with-docbook-xsl=${docbook_xsl}/xml/xsl/docbook" ];shellHook = ''PATH=$(pwd)/src/hydra-evaluator:$(pwd)/src/script:$(pwd)/src/hydra-eval-jobs:$(pwd)/src/hydra-queue-runner:$PATHPERL5LIB=$(pwd)/src/lib:$PERL5LIB'';preConfigure = "autoreconf -vfi";NIX_LDFLAGS = [ "-lpthread" ];enableParallelBuilding = true;preCheck = ''patchShebangs .export LOGNAME=''${LOGNAME:-foo}'';postInstall = ''mkdir -p $out/nix-supportfor i in $out/bin/*; doread -n 4 chars < $iif [[ $chars =~ ELF ]]; then continue; fiwrapProgram $i \--prefix PERL5LIB ':' $out/libexec/hydra/lib:$PERL5LIB \--prefix PATH ':' $out/bin:$hydraPath \--set HYDRA_RELEASE ${version} \--set HYDRA_HOME $out/libexec/hydra \--set NIX_RELEASE ${nix'.name or "unknown"}done'';dontStrip = true;meta.description = "Build of Hydra on ${system}";passthru.perlDeps = perlDeps;};};hydraJobs = {build.x86_64-linux = packages.hydra;manual =pkgs.runCommand "hydra-manual-${version}" {}''mkdir -p $out/sharecp -prvd ${pkgs.hydra}/share/doc $out/share/mkdir $out/nix-supportecho "doc manual $out/share/doc/hydra" >> $out/nix-support/hydra-build-products'';tests.install.x86_64-linux =with import (nixpkgs + "/nixos/lib/testing.nix") { system = "x86_64-linux"; };simpleTest {machine = hydraServer;testScript =''$machine->waitForJob("hydra-init");$machine->waitForJob("hydra-server");$machine->waitForJob("hydra-evaluator");$machine->waitForJob("hydra-queue-runner");$machine->waitForOpenPort("3000");$machine->succeed("curl --fail http://localhost:3000/");'';};tests.api.x86_64-linux =with import (nixpkgs + "/nixos/lib/testing.nix") { system = "x86_64-linux"; };simpleTest {machine = hydraServer;testScript =let dbi = "dbi:Pg:dbname=hydra;user=root;"; in''$machine->waitForJob("hydra-init");# Create an admin account and some other state.$machine->succeed( "su - hydra -c \"hydra-create-user root --email-address 'alice\@example.org' --password foobar --role admin\"", "mkdir /run/jobset /tmp/nix", "chmod 755 /run/jobset /tmp/nix", "cp ${./tests/api-test.nix} /run/jobset/default.nix", "chmod 644 /run/jobset/default.nix", "chown -R hydra /run/jobset /tmp/nix");$machine->succeed("systemctl stop hydra-evaluator hydra-queue-runner");$machine->waitForJob("hydra-server");$machine->waitForOpenPort("3000");# Run the API tests.$machine->mustSucceed("su - hydra -c 'perl -I ${pkgs.hydra.perlDeps}/lib/perl5/site_perl ${./tests/api-test.pl}' >&2");'';};tests.notifications.x86_64-linux =with import (nixpkgs + "/nixos/lib/testing.nix") { system = "x86_64-linux"; };simpleTest {machine = { pkgs, ... }: {imports = [ hydraServer ];services.hydra-dev.extraConfig = ''<influxdb>url = http://127.0.0.1:8086db = hydra</influxdb>'';services.influxdb.enable = true;};testScript = ''$machine->waitForJob("hydra-init");# Create an admin account and some other state.$machine->succeed( "su - hydra -c \"hydra-create-user root --email-address 'alice\@example.org' --password foobar --role admin\"", "mkdir /run/jobset", "chmod 755 /run/jobset", "cp ${./tests/api-test.nix} /run/jobset/default.nix", "chmod 644 /run/jobset/default.nix", "chown -R hydra /run/jobset");# Wait until InfluxDB can receive web requests$machine->waitForJob("influxdb");$machine->waitForOpenPort("8086");# Create an InfluxDB database where hydra will write to$machine->succeed("curl -XPOST 'http://127.0.0.1:8086/query' \\--data-urlencode 'q=CREATE DATABASE hydra'");# Wait until hydra-server can receive HTTP requests$machine->waitForJob("hydra-server");$machine->waitForOpenPort("3000");# Setup the project and jobset$machine->mustSucceed("su - hydra -c 'perl -I ${pkgs.hydra.perlDeps}/lib/perl5/site_perl ${./tests/setup-notifications-jobset.pl}' >&2");# Wait until hydra has build the job and# the InfluxDBNotification plugin uploaded its notification to InfluxDB$machine->waitUntilSucceeds("curl -s -H 'Accept: application/csv' \\-G 'http://127.0.0.1:8086/query?db=hydra' \\--data-urlencode 'q=SELECT * FROM hydra_build_status' | grep success");'';};
devShell = (import ./release.nix {hydraSrc = self;nixpkgs = nixpkgs;shell = true;inherit nix;}).build.x86_64-linux;
nixosModules.hydra = {imports = [ ./hydra-module.nix ];nixpkgs.overlays = [ self.overlay ];};