Is there any way to get notification when package fails to build on Hydra or the build succeeds after previous failures ?
Recently, some of the packages which I maintain got broken due to change in dependencies (which I don’t maintain) and I didn’t know about that. Next time, I want to know immediately when Hydra build starts failing.
Any suggestions ?
3 Likes
Common request that seems to come up about once a year:
The most-succinct comment I recall seeing on the issue/status is probably:
… and there was a situation when the situation from the second quote lead to the first one. It was something with branch setup, and Hydra ended up sending hundreds of email (per person) to a large fraction of active maintainers.
Naturally, this was found an unacceptable failure mode. Nobody since have proposed patches that would even claim to protect from this failure mode well enough that reenabling the emails could be discussed.
2 Likes
Thank you very much. Sorry for not searching by myself.
If you want to get the list of all packages failing on Hydra that you maintain, Hydra failures (7c6f434c) seems to be at least something.
2 Likes
I made simple Hydra web scraping script which will print last build status of package
#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p python3Packages.requests python3Packages.beautifulsoup4
import sys
import requests
from bs4 import BeautifulSoup
pkgs = sys.argv[1:]
exit_code = 0
for pkg in pkgs:
URL = f"https://hydra.nixos.org/job/nixpkgs/trunk/{pkg}.x86_64-linux/all"
page = requests.get(URL)
soup = BeautifulSoup(page.content, "html.parser")
results_table = soup.find("table", class_="table")
build_results = results_table.find_all("tr")
build_result = build_results[1].find_all("td")
build_status = build_result[0].img["alt"]
print(f"{pkg} - {build_status}")
if build_status != "Succeeded": exit_code = 1
sys.exit(exit_code)
Example:
$ ./hydra-build-status.py gdal pdal qgis qgis-ltr
gdal - Succeeded
pdal - Succeeded
qgis - Cancelled
qgis-ltr - Dependency failed
EDIT: Script will end with exit code 1 if Hydra build is not successful for some package. You can run it in your CI and it will notify you with failure.
2 Likes
I ended up implementing this Github Action which gives me this output .
Action runs 12 hours. I hope it wouldn’t put too much load on Hydra server, especially when more people will use it.
1 Like
vcunat
February 3, 2024, 8:27am
7
I expect it would be a bit more efficient to use /latest
instead of /all
, but hopefully it’s not significant anyway.
2 Likes