Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/tests/hydra: build a trivial derivation #40729

Merged
merged 2 commits into from Jun 6, 2018
Merged

Conversation

nlewo
Copy link
Member

@nlewo nlewo commented May 18, 2018

A script is used to create a project, and configure a jobset. This
jobset fetches a local file containing a trivial Nix expression. The
test script makes sure this derivation has been successfully built by
Hydra.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@nlewo
Copy link
Member Author

nlewo commented May 18, 2018

@GrahamcOfBorg test hydra

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: tests.hydra

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: tests.hydra

Partial log (click to expand)

machine: exit status 1
syncing
machine: running command: sync
machine: exit status 0
test script finished in 171.92s
cleaning up
killing machine (pid 593)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/h5fmmm3jap4y5srpkayi06cg0dv07rhr-vm-test-run-hydra-init-localdb

@nlewo
Copy link
Member Author

nlewo commented May 18, 2018

@spacefrogg @grahamc I don't need to set builtin in the systems list to build a simple thing. I didn't investigate yet. But, we know have a better test!


{
virtualisation.memorySize = 1024;
environment.systemPackages = [ createTrivialProject pkgs.jq ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding time.timeZone = "UTC"; here will eliminate ugly time zone warnings from the test log.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not able to find these warnings. Could you paste an example? Are they in the nix-build output or in the generated html test log?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fixed thanks (this is only visible with sandboxed builds).

$machine->succeed("create-trivial-project.sh");

# make sure the build as been successfully built
$machine->waitUntilSucceeds('curl -L -s http://localhost:3000/build/1 -H "Accept: application/json" | jq .buildstatus | xargs test 0 -eq');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test seems non-deterministic on my local machine: it succeeds the first time but then fails on repeated runs, because the jobset is unchanged and skipped by hydra, so it waits here until the waitUntilSucceeds times out .
You could fix this by artifically changing the derivation hash of the trivial derivation on every test run, for instance by making some attribute depend on current time or a random value.

Copy link
Member Author

@nlewo nlewo May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is also sometimes failing on my machine... When it fails, in the test log, there is:

machine# [   47.021598] hydra-queue-runner[1167]: marking build 1 as failed

And the log of the build is:

<3>builder for '/nix/store/nfmhzq2sv51qn1mh0lfmkpiwpk8dc2v5-trivial.drv' failed due to signal 9 (Killed)

But the output path has been produced even if the job is marked as failed. It seems this is related to Hydra and not to Nix.
Note also if I restart the job, it succeeds...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xeji I've fixed the non deterministic issue I encountered. Could you try again?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, non-deterministic failure seems gone here too. Looks good now.

@nlewo
Copy link
Member Author

nlewo commented May 23, 2018

For the non deterministic failure, see NixOS/nix#2176.

nlewo added 2 commits June 6, 2018 18:00
A script is used to create a project, and configure a jobset. This
jobset fetches a local file containing a trivial Nix expression. The
test script makes sure this derivation has been successfully built by
Hydra.
@LnL7
Copy link
Member

LnL7 commented Jun 6, 2018

@GrahamcOfBorg test hydra

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: tests.hydra

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: tests.hydra

Partial log (click to expand)

machine: exit status 1
syncing
machine: running command: sync
machine: exit status 0
test script finished in 192.04s
cleaning up
killing machine (pid 593)
vde_switch: EOF on stdin, cleaning up and exiting
vde_switch: Could not remove ctl dir '/build/vde1.ctl': Directory not empty
/nix/store/j8m86imadzfb1mv28qx4p6yw10cvmkfi-vm-test-run-hydra-init-localdb

Copy link
Member

@LnL7 LnL7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

@LnL7 LnL7 merged commit 4e0de0c into NixOS:master Jun 6, 2018
@nlewo nlewo deleted the pr-hydra-test branch June 6, 2018 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants