1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-31 04:04:45 +00:00

lnl: add hydra-job-bisect helper

This commit is contained in:
Daiderd Jordan 2018-01-18 22:07:40 +01:00
parent ca457383ab
commit 1b8e3d3aeb
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -220,18 +220,37 @@
hydra-job-revision() {
local jobseteval job=$1
jobseteval=$(curl -fL -H 'Content-Type: application/json' "$job/latest" | jq '.jobsetevals[0]')
curl -f -H 'Content-Type: application/json' "''${job%/job*}/eval/$jobseteval" | jq -r '.jobsetevalinputs.nixpkgs.revision'
shift 1
case "$job" in
*'/'*) ;;
*) job="nixpkgs/trunk/$job" ;;
esac
case "$job" in
'http://'*|'https://'*) ;;
*) job="https://hydra.nixos.org/job/$job" ;;
esac
jobseteval=$(curl -fsSL -H 'Content-Type: application/json' "$job/latest" | jq '.jobsetevals[0]')
curl -fsSL -H 'Accept: application/json' "''${job%/job*}/eval/$jobseteval" | jq -r '.jobsetevalinputs.nixpkgs.revision'
}
hydra-job-bisect() {
local job=$1
shift 1
nix-build ./pkgs/top-level/release.nix -A "''${job##*/}" --dry-run "$@" || return
git bisect start HEAD "$(hydra-job-revision "$job")"
git bisect run nix-build ./pkgs/top-level/release.nix -A "''${job##*/}" "$@"
}
hydra-job-outputs() {
local job=$1
curl -fL -H 'Content-Type: application/json' "$job/latest" | jq -r '.buildoutputs | to_entries | .[].value.path'
shift 1
curl -fsSL -H 'Accept: application/json' "$job/latest" | jq -r '.buildoutputs | to_entries | .[].value.path'
}
hydra-build-log() {
local build=$1
nix log "$(curl -f -H 'Content-Type: application/json' "$build/api/get-info" | jq -r .drvPath)"
shift 1
nix log "$(curl -fsSL -H 'Accept: application/json' "$build/api/get-info" | jq -r .drvPath)"
}
rev-darwin() {
@ -243,18 +262,22 @@
}
pr-darwin() {
rev-darwin "$(curl "https://api.github.com/repos/LnL7/nix-darwin/pulls/$@/commits" | jq -r '.[-1].sha')"
local pr=$1
shift 1
rev-darwin "$(curl "https://api.github.com/repos/LnL7/nix-darwin/pulls/$pr/commits" | jq -r '.[-1].sha')"
}
pr-nixpkgs() {
rev-nixpkgs "$(curl "https://api.github.com/repos/NixOS/nixpkgs/pulls/$@/commits" | jq -r '.[-1].sha')"
local pr=$1
shift 1
rev-nixpkgs "$(curl "https://api.github.com/repos/NixOS/nixpkgs/pulls/$pr/commits" | jq -r '.[-1].sha')"
}
reexec() {
unset __ETC_ZSHRC_SOURCED
unset __ETC_ZSHENV_SOURCED
unset __ETC_ZPROFILE_SOURCED
exec $SHELL -c 'echo "reexecuting shell: $SHELL" >&2 && exec $SHELL -l'
exec $SHELL -c 'echo >&2 "reexecuting shell: $SHELL" && exec $SHELL -l'
}
reexec-tmux() {