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

Guess channel better #40

Merged
merged 3 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,20 @@ usage: hydra-check [options] PACKAGES...
...

$ hydra-check hello
Build Status for nixpkgs.hello.x86_64-linux on unstable
Build Status for nixpkgs.hello.x86_64-linux on jobset nixos/trunk-combined
✔ hello-2.10 from 2020-03-14 - https://hydra.nixos.org/build/114752982
$ hydra-check hello --arch x86_64-darwin
Build Status for hello.x86_64-darwin on jobset nixpkgs/trunk
✔ hello-2.12.1 from 2023-09-28 - https://hydra.nixos.org/build/236635446


$ hydra-check hello python --channel 19.03
Build Status for nixpkgs.hello.x86_64-linux on 19.03
Build Status for nixpkgs.hello.x86_64-linux on jobset nixos/19.03
✔ hello-2.10 from 2019-10-14 - https://hydra.nixos.org/build/103243113
Build Status for nixpkgs.python.x86_64-linux on 19.03
Build Status for nixpkgs.python.x86_64-linux on jobset nixos/19.03
✔ python-2.7.17 from 2020-01-14 - https://hydra.nixos.org/build/110523905


$ hydra-check hello --channel nixpkgs/nixpkgs-20.03-darwin --arch=x86_64-darwin
Build Status for hello.x86_64-darwin on nixpkgs/nixpkgs-20.03-darwin
✔ hello-2.10 from 2020-04-11 - https://hydra.nixos.org/build/116372067


$ hydra-check nixos.tests.installer.simpleUefiGrub --channel 19.09 --arch aarch64-linux
Build Status for nixos.tests.installer.simpleUefiGrub.aarch64-linux on 19.09
Build Status for nixos.tests.installer.simpleUefiGrub.aarch64-linux on jobset nixos/19.09
✖ (Dependency failed) vm-test-run-installer-simpleUefiGrub from 2020-03-19 - https://hydra.nixos.org/build/115139363

Last Builds:
Expand All @@ -49,7 +45,7 @@ Last Builds:


$ hydra-check ugarit --channel 19.09 --short
Build Status for nixpkgs.ugarit.x86_64-linux on 19.09
Build Status for nixpkgs.ugarit.x86_64-linux on jobset nixos/19.09
✖ (Dependency failed) chicken-ugarit-2.0 from 2020-02-23 - https://hydra.nixos.org/build/108216732


Expand Down
11 changes: 8 additions & 3 deletions src/hydra_check/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ def process_args() -> argparse.Namespace:
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog=textwrap.dedent('''\
Other channels can be:
unstable - alias for nixos/trunk-combined (Default)
master - alias for nixpkgs/trunk
unstable - alias for nixos/trunk-combined (Default for Linux architectures)
master - alias for nixpkgs/trunk (Default for Darwin architectures)
staging - alias for nixos/staging
19.03 - alias for nixos/release-19.03
19.09 - alias for nixos/release-19.09
20.03 - alias for nixos/release-20.03
nixpkgs/nixpkgs-20.03-darwin - verbatim jobset name

Usually using the above as --channel arguments, should fit most usages.
However, you can use a verbatim jobset name such as:

nixpkgs/nixpkgs-20.03-darwin

Jobset names can be constructed with the project name (e.g. `nixos/` or `nixpkgs/`)
followed by a branch name. The available jobsets can be found at:
Expand Down Expand Up @@ -49,6 +53,7 @@ def process_args() -> argparse.Namespace:
)
parser.add_argument(
"--channel",
# Sort of changes to "master" when arch is darwin
default="unstable",
help="Channel to check packages for",
)
Expand Down
11 changes: 7 additions & 4 deletions src/hydra_check/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@


# guess functions are intended to be fast without external queries
def guess_jobset(channel: str) -> str:
def guess_jobset(channel: str, arch: str) -> str:
# TODO guess the latest stable channel
match channel:
case "master":
return "nixpkgs/trunk"
case "unstable":
return "nixos/trunk-combined"
if arch.endswith("darwin"):
return "nixpkgs/trunk"
else:
return "nixos/trunk-combined"
case "staging":
return "nixos/staging"
case _:
Expand Down Expand Up @@ -146,7 +149,7 @@ def main() -> None:
channel = args.channel
packages: list[str] = args.PACKAGES
only_url = args.url
jobset = args.jobset or guess_jobset(channel)
jobset = args.jobset or guess_jobset(channel, args.arch)
is_channel = jobset.startswith("nixos/")
as_json = args.json
all_builds = {}
Expand Down Expand Up @@ -185,7 +188,7 @@ def main() -> None:
print(Fore.YELLOW, end="")
case "✔":
print(Fore.GREEN, end="")
print(f"Build Status for {package_name} on {channel}")
print(f"Build Status for {package_name} on jobset {jobset}")
print_buildreport(latest)
if not latest["success"] and latest["evals"] and not args.short:
print()
Expand Down