1
0
Fork 0
forked from emily/nixfiles

update-nixfiles: fix eval check

This commit is contained in:
emily 2024-11-10 22:56:53 +01:00
parent 6eb2393d7e
commit 30665c65aa
Signed by untrusted user: emily
GPG key ID: F6F4C66207FCF995

View file

@ -21,7 +21,6 @@ merge_theirs () {
} }
test_build () { test_build () {
local last_error
local build_jobs local build_jobs
build_jobs="$(curl --fail -s -L -H "Accept: application/json" "${JOBSET_URL}/latest-eval" | jq -r ".builds | .[]")" build_jobs="$(curl --fail -s -L -H "Accept: application/json" "${JOBSET_URL}/latest-eval" | jq -r ".builds | .[]")"
@ -42,10 +41,16 @@ test_build () {
echo "Build ${build} was successful" echo "Build ${build} was successful"
done done
last_error="$(curl --fail -s -L -H "Accept: application/json" "${JOBSET_URL}" | jq -r ".errortime")" # Idk why this is broken someone should fix me
[[ $last_error -gt $(date +%s) ]] && # local last_error
echo "Evaluation error encountered at $(date +%Y-%m-%d-%H:%M:%S --date="@${last_error}")" && # local now
exit 1 #
# last_error="$(curl --fail -s -L -H "Accept: application/json" "${JOBSET_URL}" | jq -r ".errortime")"
# now="$(date +%s)"
#
# [[ $last_error -gt $now ]] &&
# echo "Evaluation error encountered at $(date +%Y-%m-%d-%H:%M:%S --date="@${last_error}")" &&
# exit 1
} }
wait_for_hydra () { wait_for_hydra () {
@ -54,15 +59,17 @@ wait_for_hydra () {
local counter local counter
counter=0 counter=0
git_rev="$(git -C "${1}/nixfiles" rev-parse update-inputs)" git_rev="$(git -C "${1}/nixfiles" rev-parse update-inputs)"
while true; do while [[ $counter -lt 180 ]]; do
hydra_rev="$(curl -s -L -H "Accept: application/json" "${2}/latest-eval" | jq -r .flake | sed -E "s/.+&rev=(.*)/\1/g")" counter=$((counter +1))
hydra_rev="$(curl -s -L -H "Accept: application/json" "${2}/evals" | jq -r '.evals | max_by(.id) | .flake' | sed -E "s/.+&rev=(.*)/\1/g")"
if [[ "${git_rev}" == "${hydra_rev}" ]]; then if [[ "${git_rev}" == "${hydra_rev}" ]]; then
echo "Hydra got new commit" echo "Hydra got new commit"
break break
fi fi
sleep 30 sleep 5
done done
if [[ $counter -ge 30 ]]; then
if [[ $counter -ge 180 ]]; then
echo "Hydra no workey" echo "Hydra no workey"
exit 1 exit 1
fi fi