Jenkins Multibranch pipeline first trigger

Hi All,

I am facing one issue with Jenkins multibranch pipeline. below is the scenario.
I have GitHub org and Jenkins and multibranch pipeline has been configured and the build trigger is set to build everything nothing to suppress.
Now GitHub is migrating to different host so for this I reconfigure the Jenkins to use new API endpoint and for build trigger I am setting “for matching branches suppress the build triggered by indexing (continue to honor webhooks)” just to ensure pipeline will not trigger and mesh with infra.
But when I am committing some change on the new GitHub repo pipeline is getting triggered but unable to fetch the changes and showing no commit but on the seconded commit it is able to fetch the changes and working as desired.
Can someone help on this how to fix this. Thank you

Hello and welcome to this community, @skull-Atul. :wave:

This issue might have occurred because the Jenkins Multibranch Pipeline may have cached metadata or is encountering a mismatch between indexing and webhook-triggered builds. :thinking:

Steps that may help to fix your issue:

  1. Clear Branch Indexing Cache in Jenkins:
  • Go to Jenkins Dashboard > Multibranch Pipeline Job > Scan Repository Now.
  • This should force Jenkins to update the branch metadata and ensures all changes from the new repository are fully indexed. :crossed_fingers:
  1. Check Webhook Integration:
  • Verify that the new GitHub repository is correctly integrated with Jenkins:
    • GitHub Webhook URL: http(s)://<jenkins-server>/github-webhook/.
    • Confirm the webhook events for push, pull request, etc., are being sent.
    • Validate that the Jenkins GitHub plugin has access to the new API endpoint.
  1. Adjust Git Clone Behavior:
  • In the pipeline configuration, ensure the Git plugin is not restricted to shallow clones. Sometimes, shallow clones can cause issues in detecting new commits.
    • Under “Behaviors”, click Add; look for Advanced clone behaviours, and check “Shallow clone” is unchecked.
  1. Enable Verbose Logging:
  • In the Jenkins system configuration:
    • Go to Manage Jenkins > System Log > Add new log recorder.
    • Add logs for org.jenkinsci.plugins to debug the GitHub plugin.
  • Check logs for any discrepancies during the webhook processing.
  1. Manually Trigger Initial Build:
  • To handle the initial state mismatch, you can:
    • Disable the webhook temporarily.
    • Trigger a manual build for each branch to ensure the repository is in sync.
    • Re-enable the webhook once manual builds have succeeded.