Hydra-check: Does package X still build on channel Y?

Hey all, i want to share my evening project which fetches the necessary information to know if a package X still builds on channel Y (or last master branch).

the package repo currently resides under https://github.com/makefu/hydra-check and hopefully soon packaged inside nixpkgs.

Because only real-world usage is the truth, here are some usage examples:

$ nix-shell

$ hydra-check --help
usage: hydra-check [options] PACKAGE [CHANNEL]
...
# default channel is unstable
$ hydra-check hello
✔ hello-2.10 https://hydra.nixos.org/build/113804835

$ hydra-check hello 19.03
✔ hello-2.10 https://hydra.nixos.org/build/103243113

$ hydra-check nixos.tests.installer.simpleUefiGrub 19.09 --arch aarch64-linux
✖ (Failed) vm-test-run-installer-simpleUefiGrub https://hydra.nixos.org/build/113892497

Last Builds:
✖ (Failed) vm-test-run-installer-simpleUefiGrub https://hydra.nixos.org/build/113857097
✔ vm-test-run-installer-simpleUefiGrub https://hydra.nixos.org/build/113855182
✔ vm-test-run-installer-simpleUefiGrub https://hydra.nixos.org/build/113849540
✔ vm-test-run-installer-simpleUefiGrub https://hydra.nixos.org/build/113448926
...

$ hydra-check ugarit 19.09 --short
✖ (Dependency failed) chicken-ugarit-2.0 https://hydra.nixos.org/build/108216732

$ hydra-check nixos.containerTarball 19.09 --arch i686-linux --json | jq .
[
  {
    "icon": "✖",
    "success": false,
    "status": "Failed",
    "timestamp": "2020-03-05T15:03:15Z",
    "build_id": "113892448",
    "build_url": "https://hydra.nixos.org/build/113892448",
    "name": "tarball",
    "arch": "i686-linux"
  },
  {
    "icon": "✔",
    "success": true,
    "status": "Succeeded",
    "timestamp": "2020-03-04T14:56:01Z",
    "build_id": "113857110",
    "build_url": "https://hydra.nixos.org/build/113857110",
    "name": "tarball",
    "arch": "i686-linux"
  },
  {
    "icon": "✖",
    "success": false,
    "status": "Failed",
    "timestamp": "2020-03-04T02:52:56Z",
    "build_id": "113855194",
    "build_url": "https://hydra.nixos.org/build/113855194",
    "name": "tarball",
    "arch": "i686-linux"
  },
  ...
]

Disclaimer: keep in mind that hydra is busy doing actual work and requests may require considerable time to complete

10 Likes

This program is very useful. I always lacked an easy way to get build urls out hydra, I never figured out how to do that from the website. Thanks for creating this. Have you thought already about adding it to Nixpkgs?

Thanks for the reply!

I wanted to receive a bit of feedback before pushing the tool into nixpkgs. I also had a bit of discussion with @Mic92 that an integration into nix-review would be quite nice to check if the failed dependency ever even built before or if it broke by the PR.

3 Likes

Looks very neat! Currently I usually fuzzy-search my browser history for some url (like https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.newsboat.x86_64-linux) to a hydra job and then just manually replace the attribute name.

I think it would be pretty useful to provide the job URL in addition to the direct build urls.

The script is essentially building your fuzzy-searched URL based on a couple of assumptions like:

  • master branch -> nixpkgs/trunk
  • unstable channel -> nixos/trunk-combined
  • 20.03 -> nixos/release-20.03

Additionally on channels the packages are called: nixpkgs.<name>.<arch> but on the master branch it is just called <name>.<arch>

For someone who is new to the hydra job structure (like me a week ago) this is very confusing.

The whole code is currently 120 lines where most code is guessing the correct URL parsing the html.

For performance reason I will probably use the binary cache instead of hydra. But it is still nice to have hydra-check as a standalone tool.

1 Like

I’ve added hydra-check --url to only print the hydra URL and exit:

hydra-check --url hello
https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.hello.x86_64-linux