6

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?). Failed Check

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.

S.Spieker
  • 7,005
  • 8
  • 44
  • 50
Meiswjn
  • 752
  • 6
  • 17

1 Answers1

0

¿Are you using Multibranch Pipeline plugin?

By default, Jenkins will not automatically re-index the repository for branch additions or deletions (unless using an Organization Folder), so it is often useful to configure a Multibranch Pipeline to periodically re-index in the configuration

Source: https://www.jenkins.io/doc/book/pipeline/multibranch/

Maybe this can also help: What are "Branch indexing" activities in Jenkins BlueOcean

Atxulo
  • 466
  • 3
  • 7
  • Hi, Yes, we are using that plugin. But this is a different topic, I think. If you think this is the right direction, can you please specify? – Meiswjn Jan 31 '23 at 13:27