Use system-features from the Nix conf in the default machine file

[?]
Apr 28, 2021, 9:43 AM
4Y3LBQYIG5VWPKPEP74XEGJ7KYP5AAT6OQYZP5TXQNHNHK7KP6LAC

Dependencies

  • [2] 7KLHBDYA Fix build
  • [3] 2JJP7673 tests: move to t, allow `yath test` from root
  • [4] 6HYCG3DC tests: allow specifying some nix config
  • [5] H7SZRHUB Use nix::willBuildLocally()
  • [6] O3NM62IZ Support multiple machines files
  • [7] 73YR46NJ hydra-queue-runner: Write directly to a binary cache
  • [8] X6FOUYFJ int2String -> std::to_string
  • [*] 24BMQDZA Start of single-process hydra-queue-runner
  • [*] HX4QYOYA add first evaluations tests
  • [*] UIA3ULNU Give each test its own Nix directories

Change contents

  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 159
    [2.152][5.0:69](),[5.1877][5.0:69](),[5.57][5.0:69]()
    + " - " + std::to_string(settings.maxBuildJobs) + " 1");
    [2.152]
    [5.449]
    + " - " + std::to_string(settings.maxBuildJobs) + " 1 "
    + concatStringsSep(",", settings.systemFeatures.get()));
  • file addition: default-machine-file.t (----------)
    [3.697]
    use feature 'unicode_strings';
    use strict;
    use Setup;
    my %ctx = test_init();
    require Hydra::Schema;
    require Hydra::Model::DB;
    use Test2::V0;
    my $db = Hydra::Model::DB->new;
    hydra_setup($db);
    my $project = $db->resultset('Projects')->create({name => "tests", displayname => "", owner => "root"});
    my $jobset = createBaseJobset("default-machine-file", "default-machine-file.nix", $ctx{jobsdir});
    ok(evalSucceeds($jobset), "Evaluating jobs/default-machine-file.nix should exit with return code 0");
    is(nrQueuedBuildsForJobset($jobset), 1, "Evaluating jobs/default-machine-file.nix should result in 1 build");
    for my $build (queuedBuildsForJobset($jobset)) {
    ok(runBuild($build), "Build '".$build->job."' from jobs/default-machine-file.nix should exit with code 0");
    my $newbuild = $db->resultset('Builds')->find($build->id);
    is($newbuild->finished, 1, "Build '".$build->job."' from jobs/default-machine-file.nix should be finished.");
    my $expected = $build->job eq "fails" ? 1 : $build->job =~ /with_failed/ ? 6 : 0;
    is($newbuild->buildstatus, $expected, "Build '".$build->job."' from jobs/default-machine-file.nix should have buildstatus $expected.");
    }
    done_testing;
  • file addition: default-machine-file.nix (----------)
    [3.1263]
    with import ./config.nix;
    {
    requireExperimentalFeatures =
    mkDerivation {
    name = "empty-dir";
    builder = ./empty-dir-builder.sh;
    requiredSystemFeatures = [ "test-system-feature" ];
    };
    }
  • edit in t/lib/Setup.pm at line 51
    [12.1878]
    [4.57]
    print $fh "system-features = test-system-feature\n";