• Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • core, job-dsl-plugin
    • None

      I have a multi branch pipeline job which is defined via Job DSL. ( See attachment)

      This job is run against Bitbucket Cloud, and has worked previously. I have recently upgraded to Jenkins 2.451 on JDK 21. Previously I was using Jenkins 2.440 on JDK 11. 

      This error may be after the upgrade, however I am not certain.

      This is the error I see:  in https://jenkins/job/job-name/scmPollLog/:

       Started on Apr 4, 2024, 1:34:00 PM
      ERROR: Failed to record SCM polling for org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject@43b1fb01[Vmol-Branch]
      java.lang.NullPointerException: Cannot invoke "jenkins.triggers.SCMTriggerItem.poll(hudson.model.TaskListener)" because the return value of "hudson.triggers.SCMTrigger.job()" is null
      	at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:617)
      	at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:664)
      	at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:123)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
      	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.base/java.lang.Thread.run(Unknown Source)

          [JENKINS-72963] SCM Polling Failing

          Jesse Glick added a comment -

          SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem is marked @CheckForNull yet SCMTrigger is not doing so. It should behave more gracefully.

          In this case the error is because SCM polling is supposed to operate on a job, not a folder, so I guess that is a user error. For multibranch projects you would not use SCMTrigger at all (not even on the branch projects); you would use webhooks and/or branch reindexing. It is arguably a bug in job-dsl that it even lets you specify pollSCM inside multibranchPipelineJob, since this could never work, and SCMTrigger.DescriptorImpl.isApplicable would correctly return false on a WorkflowMultiBranchProject.

          Jesse Glick added a comment - SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem is marked @CheckForNull yet SCMTrigger is not doing so. It should behave more gracefully. In this case the error is because SCM polling is supposed to operate on a job, not a folder, so I guess that is a user error. For multibranch projects you would not use SCMTrigger at all (not even on the branch projects); you would use webhooks and/or branch reindexing. It is arguably a bug in job-dsl that it even lets you specify pollSCM inside multibranchPipelineJob , since this could never work, and SCMTrigger.DescriptorImpl.isApplicable would correctly return false on a WorkflowMultiBranchProject .

          Chandana added a comment -

          jglick , thanks for that explanation. I can't use webhooks in my environment.  Not sure what "branch reindexing" means, but I will remove the trigger and enable periodicFolderTrigger

          Chandana added a comment - jglick , thanks for that explanation. I can't use webhooks in my environment.  Not sure what "branch reindexing" means, but I will remove the trigger and enable periodicFolderTrigger

          Jesse Glick added a comment -

          Yes periodicFolderTrigger sounds like the right thing: scheduled branch indexing.

          Jesse Glick added a comment - Yes periodicFolderTrigger sounds like the right thing: scheduled branch indexing.

            Unassigned Unassigned
            chandana_desilva_id_au Chandana
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: