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

Poll per change with multibranch pipeline jobs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • p4-plugin

      Feature request: Implement poll per change on multibranch pipeline jobs.

      With multibranch poll per change doesnt poll every change but does build only the next change that needs to be built.For example:

      (1) Add CL 626, 627 and 628.

      (2) The multi branch top level poll is configured for 1 min (see below). When it triggers it detects that 625 to 628 exist.

      (3) The job checks SyncID and correctly finds '625' as the previous last sync.   

      Found last change 625 on syncID jenkins-NODE_NAME-MultiBranch_PollPerChange-main-EXECUTOR_NUMBER

      (4) Due to filtering only the next changelist is synced:

                P4 Task: syncing files at change: 626

      (5) Jenkins records the last successful build for this branch correctly:

                branches/main/lastSuccessful/build.xml:          <change>626</change>

      (6) But (and I'm guessing this is the cause) sets '628' in the following file:

                branches/main/scm-revision-hash.xml

      The next time a poll runs it will only fire if a new changelist has been created but will build changelist '627' only (so will now be building 2 changelists behind current).
       
      My Jenkinsfile:

           1    pipeline {
           2      agent { label 'master' }
           3      options { skipDefaultCheckout() }
           4      stages {
           5        stage("Repro") {
           6          steps {
           7            script {
           8               checkout perforce(credential: 'MasterServer', filter: [incremental(true)], populate: autoClean(delete: true, modtime: false, parallel: [enable: false, minbytes: '1024', minfiles: '1', threads: '4'], pin: '', quiet: true, replace: true, tidy: false), workspace: manualSpec(charset: 'none', name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, spec: clientSpec(allwrite: false, backup: false, clobber: true, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', streamName: '', type: 'WRITABLE', view: '//depot/multibranch_poll_per_change/main/... //jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}/...')))
           9               sh "pwd"
          10               sh "ls -l"
          11           sh "cat -n *"
          12           sh "echo ${env.BRANCH_NAME}"
          13            }
          14          }
          15        }
          16      }
          17    }

       

       

            p4paul Paul Allen
            p4karl Karl Wirth
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: