Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-47077

"Periodically if not otherwise run" interval does not trigger index scan

    XMLWordPrintable

    Details

    • Similar Issues:
    • Released As:
      6.7

      Description

      I have set up a multibranch pipeline with Bitbucket Cloud repository.
      I am running jenkins locally, so I am not using webhooks.

      I've set "Periodically if not otherwise run" interval to 2 minutes, but repository is not being scanned for changes. Scanning can only be triggered manualy by "Scan Multibranch pipeline now".

      I've tried to set this up from blue ocean, then from old UI and no luck in both.
      Also using regular Git branch source instead of Bitbucket doesn't work.

      So I guess the problem is with multibranch pipeline itself.

        Attachments

          Issue Links

            Activity

            Hide
            stephenconnolly Stephen Connolly added a comment -

            Hmmm so https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/triggers/Trigger.java#L226 is responsible to call Trigger.checkTriggers periodically.

            https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/triggers/Trigger.java#L269 runs the triggers... but only on ParameterizedJobMixIn.ParameterizedJob (at least since this change) so how is the org folder getting triggered?

            Ahhh folders takes care of it itself

            Ok... so can people affected by this issue try running the following script in the system groovy console:

            for (def p in Jenkins.getInstance().allItems(com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.class)) {
                for (def t in p.getTriggers().values()) {
                  if (t.tabs == null) println("${p.fullName} trigger ${t.class.name} not started");
                }
            }
            

            If you get a report of any of the triggers not being started then that would point to an NPE in FolderCron being the root cause.

            NOTE: I do not expect the above to be the cause. My Jenkins is on 2.89.4 and on a newly created org folder it is fine as well as on an existing org folder, e.g. see the following three screenshots that illustrate the org folder scan being daily and the multibranch scans being daily - but at different points in time - and I had not logged into my Jenkins in over a week before taking these screenshots!

            Show
            stephenconnolly Stephen Connolly added a comment - Hmmm so https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/triggers/Trigger.java#L226 is responsible to call Trigger.checkTriggers periodically. https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/triggers/Trigger.java#L269 runs the triggers... but only on ParameterizedJobMixIn.ParameterizedJob (at least since this change ) so how is the org folder getting triggered? Ahhh folders takes care of it itself Ok... so can people affected by this issue try running the following script in the system groovy console: for (def p in Jenkins.getInstance().allItems(com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.class)) { for (def t in p.getTriggers().values()) { if (t.tabs == null ) println( "${p.fullName} trigger ${t. class. name} not started" ); } } If you get a report of any of the triggers not being started then that would point to an NPE in FolderCron being the root cause. NOTE: I do not expect the above to be the cause. My Jenkins is on 2.89.4 and on a newly created org folder it is fine as well as on an existing org folder, e.g. see the following three screenshots that illustrate the org folder scan being daily and the multibranch scans being daily - but at different points in time - and I had not logged into my Jenkins in over a week before taking these screenshots!
            Hide
            stephenconnolly Stephen Connolly added a comment -

            What I do find interesting is this one:

            There is more than 24h since that one ran. It should run once every 24h, but it seems to be running every 48h.

            Hmmm H H * * * is the crontab... so if that picks any time before 19:49 then yesterday it would have been less than 24h since the last run and so it would only pick up the run today... presumably it will run at 19:49 today but the last triggered field will be out my some number of milliseconds and so effectively it runs every second interval

            Show
            stephenconnolly Stephen Connolly added a comment - What I do find interesting is this one: There is more than 24h since that one ran. It should run once every 24h, but it seems to be running every 48h. Hmmm H H * * * is the crontab... so if that picks any time before 19:49 then yesterday it would have been less than 24h since the last run and so it would only pick up the run today... presumably it will run at 19:49 today but the last triggered field will be out my some number of milliseconds and so effectively it runs every second interval
            Hide
            stephenconnolly Stephen Connolly added a comment -

            https://github.com/jenkinsci/cloudbees-folder-plugin/pull/119 might fix the incidental issue of "every minute" not running every minute... but it would be really good to understand how others are not getting the child multibranch scan being triggered at least once every two days?

            OR is it being triggered once every two days, but the org folder is set to a higher interval and thus "longer than every 2 days" is being translated into "never" because people are manually triggering as a workaround to being unable to configure the child triggers

            Show
            stephenconnolly Stephen Connolly added a comment - https://github.com/jenkinsci/cloudbees-folder-plugin/pull/119 might fix the incidental issue of "every minute" not running every minute... but it would be really good to understand how others are not getting the child multibranch scan being triggered at least once every two days? OR is it being triggered once every two days, but the org folder is set to a higher interval and thus "longer than every 2 days" is being translated into "never" because people are manually triggering as a workaround to being unable to configure the child triggers
            Hide
            aairey Andy Airey added a comment -

            We have to scan all our multibranch pipeline repositories separately and cannot configure them (yet) as stated above...
            Otherwise the branch and PR jobs never get triggered.

            Also the new Bitbucket webhooks are not supported (JENKINS-47891) yet so we are kind of stuck  as we cannot install extra plugins on Bitbucket Server.
            This is really annoying.

            Show
            aairey Andy Airey added a comment - We have to scan all our multibranch pipeline repositories separately and cannot configure them (yet) as stated above... Otherwise the branch and PR jobs never get triggered. Also the new Bitbucket webhooks are not supported ( JENKINS-47891 ) yet so we are kind of stuck  as we cannot install extra plugins on Bitbucket Server. This is really annoying.
            Hide
            mslattery Michael Slattery added a comment - - edited

            As a workaround, we created a pipeline job as follows:

            import org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject;
            node {
                Jenkins.instance.items
                .findAll { it instanceof WorkflowMultiBranchProject }
                .each {
                    echo it.name
                    it.indexing.run()
                }
            }
            

            I set it to trigger to build periodically, every two minutes: H/2 * * * *

            But, I had to do script approvals.  This is temporary for us until this bug gets fixed, after which I'll remove this job and the script approvals.

            Show
            mslattery Michael Slattery added a comment - - edited As a workaround, we created a pipeline job as follows: import org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject; node { Jenkins.instance.items .findAll { it instanceof WorkflowMultiBranchProject } .each { echo it.name it.indexing.run() } } I set it to trigger to build periodically, every two minutes: H/2 * * * * But, I had to do script approvals.  This is temporary for us until this bug gets fixed, after which I'll remove this job and the script approvals.

              People

              • Assignee:
                stephenconnolly Stephen Connolly
                Reporter:
                wojciechrak Wojciech Rak
              • Votes:
                9 Vote for this issue
                Watchers:
                14 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: