This issue is also described in https://issues.jenkins.io/browse/JENKINS-70459
When using Jenkins, we noticed that the wrong pipeline status is often reported in GitHub PRs.
Further investigation showed very odd behavior. We have not yet found the cause of this problem (random?).
The 'Detail' link leads to the build which is successful.
Now comes the odd thing: The Jenkins log shows that the same build id was build twice!
First, it runs successful (trigger: PR Update). Here is an excerpt from the log:
{ [-]
build_number: 2
build_url: job/(...)/PR-2906/2/
event_tag: job_event
job_duration: 1108.635
job_name: (...)/PR-2906
job_result: SUCCESS
job_started_at: 2023-01-19T14:41:14Z
job_type: Pipeline
label: master
metadata: { [+]
}
node: (built-in)
queue_id: 1781283
queue_time: 5.063
scm: git
test_summary: { [+]
}
trigger_by: Pull request #2906 updated
type: completed
upstream:
user: anonymous
}
Then, another run, under the exact same build id / url appears in the log:
{
build_number: 2
build_url: job/(...)/PR-2906/2/
event_tag: job_event
job_duration: 1.959
job_name: (...)/PR-2906
job_result: FAILURE
job_started_at: 2023-01-20T07:14:50Z
job_type: Pipeline
label: master
node: (built-in)
queue_id: 2261495
queue_time: 7.613
test_summary: { [+]
}
trigger_by: Branch indexing
type: completed
upstream:
user: anonymous
}
Notice that the trigger is now "Branch indexing". We do not know why this build happens but it is likely the root cause of this issue.
The failed build is not displayed in the Jenkins UI and the script console also returns #2 as the last successful build. We assume that this "corrupt" build is reported to GitHub. Does anyone have any ideas how this may happen? Any ideas are very welcome!
We checked our logs and tried to reproduce this behaviour - unsuccessful, so far.