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

P4Plugin Polls Workspaces With Disabled Polling (poll: false)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • p4-plugin
    • Jenkins: 2.150.3 (official docker image)
      P4 Plugin: 1.9.6

      Hello

      P4Plugin polls all workspaces used in job even if poll parameter is disabled in checkout.

      Steps to reproduce

      1. Create pipeline job test4 (see below)
      2. Start pipeline job test4
      3. See "Perforce Software Polling Log" and Perforce Server Log

       

       

      pipeline {
          agent(none)
       
          options {
              ansiColor("xterm")
              buildDiscarder(logRotator(numToKeepStr: "10"))
              disableConcurrentBuilds()
              disableResume()
              skipDefaultCheckout(true)
              timestamps()
          }
       
          triggers {
              pollSCM("* * * * *")
          }
       
          stages {
              stage("Master") {
                  agent {
                      label("master")
                  }
       
                  steps {
                      checkout perforce(credential: 'perforce-ticket-jenkins', populate: flushOnly(pin: '', quiet: false),
                              workspace: streamSpec(charset: 'none', format: 'test4-master', pinHost: true, streamName: '//playground/jenkins-main'))
                  }
              }
       
              stage("Win-1") {
                  agent {
                      label("k02-bld-win-01")
                  }
       
                  steps {
                      checkout changelog: false, poll: false, scm: perforce(credential: 'perforce-ticket-jenkins', populate: flushOnly(pin: '', quiet: false),
                              workspace: streamSpec(charset: 'none', format: 'test4-win-1', pinHost: true, streamName: '//playground/jenkins-main'))
                  }
              }
      
              stage("Win-2") {
                  agent {
                      label("k02-bld-win-02")
                  }
       
                  steps {
                      checkout changelog: false, poll: false, scm: perforce(credential: 'perforce-ticket-jenkins', populate: flushOnly(pin: '', quiet: false),
                              workspace: streamSpec(charset: 'none', format: 'test4-win-2', pinHost: true, streamName: '//playground/jenkins-main'))
                  }
              }
          }
      }
      

       

      Perforce Software Polling Log

       

      Started on Feb 22, 2019 3:45:00 PM
      P4: Polling on: master with:test4-master
      Found last change 1180191 on syncID test4-master
      ... p4 client -o test4-master +
      ... p4 info +
      ... p4 info +
      ... p4 client -o test4-master +
      ...   No change in client detected.
       
      P4 Task: establishing connection.
      ... server: perforce:1666
      ... node: k02-jenkins
      P4: Polling with range: 1180191,now
      ... p4 changes -m20 //test4-master/...@1180191,now +
      ... p4 repos -C +
      P4: Polling on: master with:test4-win-1
      Found last change 1180191 on syncID test4-win-1
      ... p4 client -o test4-win-1 +
      ... p4 info +
      ... p4 info +
      ... p4 client -o test4-win-1 +
      ...   No change in client detected.
       
      P4 Task: establishing connection.
      ... server: perforce:1666
      ... node: k02-jenkins
      P4: Polling with range: 1180191,now
      ... p4 changes -m20 //test4-win-1/...@1180191,now +
      ... p4 repos -C +
      P4: Polling on: master with:test4-win-2
      Found last change 1180191 on syncID test4-win-2
      ... p4 client -o test4-win-2 +
      ... p4 info +
      ... p4 info +
      ... p4 client -o test4-win-2 +
      ...   No change in client detected.
       
      P4 Task: establishing connection.
      ... server: perforce:1666
      ... node: k02-jenkins
      P4: Polling with range: 1180191,now
      ... p4 changes -m20 //test4-win-2/...@1180191,now +
      ... p4 repos -C +
      Done. Took 0.14 sec
      No changes
      

       

      Perforce Server Error Log

      4,1550834520,532931606,2019/02/22 13:22:00 532931606,210535,1,jenkins,test4-win-1,user-repos,10.10.20.103,jenkins.p4-plugin,1.9.6/Linux,-C,error,6,95,Client %27test4-win-1%27 can only be used from host %27k02-bld-win-01%27.
       
      4,1550834520,580422337,2019/02/22 13:22:00 580422337,210544,1,jenkins,test4-win-2,user-repos,10.10.20.103,jenkins.p4-plugin,1.9.6/Linux,-C,error,6,95,Client %27test4-win-2%27 can only be used from host %27k02-bld-win-02%27.
       
       
      

       

      As you can see jenkins tries to poll all three workspaces: test4-master (poll: true) + test4-win-1 (poll: false) + test4-win-2 (poll: false) from master.

       

      Cause

      WorkflowJob.poll() uses PerforceScm.getKey() to find a polling baseline for workspaces.

      PerforceScm.getKey() returns the same SCM key for different workspaces because it doesn't include a workspace name.

      Result: WorkflowJob.poll() polls all workspaces with the same SCM key.

      PR

      I have created a pull request with a possible fix of this problem:

      https://github.com/jenkinsci/p4-plugin/pull/95

       

      Please fix this bug.

      Thank you

            cbopardikar Charusheela Bopardikar
            lystor Mykola Ulianytskyi
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: