report_job_log.py always says the job failed, even when it passed #8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
report_job_log.py:148hardcodes the word failed into the comment header:Every current caller guards it with
if: failure(), so today the wording isalways true and this is latent, not broken.
It stopped being purely theoretical during weblib-viewer#10. A throwaway probe
job ran the script with an unguarded step to read the runner's egress back —
job logs still 500 on this Gitea, so posting the tail as a comment is the only
way to see anything — and the successful run posted a comment that reads as
a failure report. Anyone scrolling that PR would conclude the probe had failed
when it had passed.
Fix
Take the outcome as an argument rather than assuming it, e.g.
--status failed|passed(or read${{ job.status }}at the call site), and pick theheader from it. Keep
failedas the default so no existing caller changesbehaviour.
Worth doing because the interesting uses of this script are exactly the ones
that want
if: always()— a probe, or a job whose output is the point ratherthan its exit code. Right now those all lie in the header.
Filed from weblib-viewer#10;
Type/Bugbecause the output is wrong,Priority/Lowbecause no current caller can hit it.