Closed fxcoudert closed 2 years ago
I’m away for the next few hours but I’ll look into this when I return.
First, I think this happens when livecheck
doesn't match anything, which could be due to URL or pattern.
The actual error is due to how test-bot
handles the result in
https://github.com/Homebrew/homebrew-test-bot/blob/b4fd3be21fd543587731eac424e2bed41aa5cbf3/lib/tests/formulae.rb#L226-L229
return unless livecheck_step.output?
livecheck_info = JSON.parse(livecheck_step.output)
return unless livecheck_info.first["version"]["newer_than_upstream"]
It probably isn't detecting the livecheck
output correctly and fails the entire CI run rather than returning.
In the case there is a failure, livecheck_step.output
is a valid JSON, but doesn't have version
which would cause nil
output.
Probably need to do some extra sanitization checks to make sure of things like livecheck_info.first["version"]
is not nil
.
On side note, in case of kim-api
, livecheck
result would probably be due to same reason as why download is failing. This may be fixed by changing download URL to
url "https://s3.openkim.org/kim-api/kim-api-2.3.0.txz", using: :homebrew_curl
However, the test-bot
should also be fixed to avoid blocking CI runs..
The error was with :homebrew_curl
on the main URL. I tried to add it to livecheck's URL, but this is rejected by audit: https://github.com/Homebrew/homebrew-core/runs/6335695332?check_suite_focus=true
Probably need to do some extra sanitization checks to make sure of things like
livecheck_info.first["version"]
is notnil
.
The assumption was that the exit code would indicate success. It seems this is not always the case for --json
so logic would need to be there to check status
in the JSON but still fail overall CI in the case of a error.
I tried to add it to livecheck's URL, but this is rejected by audit
livecheck
block URLs don't accept trailing options like using: :homebrew_curl
yet. This general idea is part of the forthcoming options
feature in livecheck, which I still need to create a PR for (I've had it implemented for ages but it will involve some discussion and probably some rework). I've been busy with other things (e.g., tying up loose ends around my Utils::Curl
changes and working on some refactoring) and there are a few other livecheck changes that I want to merge first but we'll eventually be able to explicitly specify that a livecheck
block should use brewed curl.
In the interim time, livecheck will use brewed curl for the check if the stable
(or head
) URL includes using: :homebrew_curl
. It looks like there was one revision where that was the case. Did that work when you tried it?
If not, kim-api
may be another case where the check works fine locally but fails on CI. We encountered this scenario before with juman
but I couldn't figure out why it only failed on CI, so the livecheck
block was removed for the moment (despite it working locally).
The test-bot bug will be addressed in Homebrew/homebrew-test-bot#802 but that only appears because the livecheck
block encounters an error, so we'll need to fix the livecheck
block regardless.
Even with using: :homebrew_curl
in the main URL, it still fails. See https://github.com/Homebrew/homebrew-core/runs/6339592998?check_suite_focus=true
See this PR: https://github.com/Homebrew/homebrew-core/pull/101026 which fails with:
I do not know why we get
undefined method
[]' for nil:NilClass`, the livecheck block seems ok to me.