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

Perforce plugin incorrectly triggers multibranch builds




      Due to the change done for JENKINS-61745 multibranch pipeline builds that track Perforce streams end up getting triggered for any new changelist on the Perforce server as soon as the stream in question is over 1000 revisions behind the latest revision on the server. In our case this translates to any stream that hasn't had a change submitted in about a week. With the number of streams that we use this ends up triggering enough builds often enough to completely clog up our build pipeline meaning we have had to disable automatic multibranch builds.

      The bug is rooted in how the Perforce plugin determines the latest change for a stream when performing branch indexing.

      The problematic code is in ClientHelper.java method getClientHead(). The code determines the latest change on the server, gets the changes for the given path that has happened between the latest and (latest - 1000), and if there are no changes it returns the latest server change as the latest change to the path. The last conditional at https://github.com/jenkinsci/p4-plugin/blob/7cd96e85532b1fdfc918eeef525cc2d23789471a/src/main/java/org/jenkinsci/plugins/p4/client/ClientHelper.java#L1113-L1121 should be changed to return a value that indicates that there have been no changes in the given revision range, and in the case of multibranch builds this should result in no build being triggered.



          ihalila_ser Ilkka Halila created issue -
          p4karl Karl Wirth made changes -
          Field Original Value New Value
          Labels P4_B
          p4paul Paul Allen made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          p4paul Paul Allen made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Fixed but Unreleased [ 10203 ]
          p4paul Paul Allen made changes -
          Status Fixed but Unreleased [ 10203 ] Closed [ 6 ]
          p_hampson Paul "TBBle" Hampson made changes -
          Labels P4_B P4_B multi-branch
          p4karl Karl Wirth made changes -
          Labels P4_B multi-branch P4_A multi-branch


            p4paul Paul Allen
            ihalila_ser Ilkka Halila
            0 Vote for this issue
            3 Start watching this issue