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

Add support for polling multiple checkouts with pipeline scripts

    • Icon: New Feature New Feature
    • Resolution: Fixed
    • Icon: Critical Critical
    • p4-plugin
    • Jenkins 2.19.2, all pipeline-related plugins at latest version, p4-plugin at version 1.4.8

      We're attempting to run some large pipeline jobs. Each job goes and runs a series of parallel jobs on multiple platforms for multiple targets.

      When adding the options to include in changelog/polling that are now available:

                  checkout([
                      changelog: true, 
                      poll: true, 
                      scm: [
                          $class: 'PerforceScm', 
                          credential: credential, 
         ...
      

      The job will try to poll for changes. It correctly polls the actual Jenkinsfile, but when it goes to poll for each separate checkout in the pipeline script, it loses track of the previous change it built at and continually triggers a new build.

      The name of our generated clients is:
      'jenkins-${NODE_NAME}${JOB_NAME}${BUILD_NUMBER}-' + platform

      The p4 plugins normally adds a "Description:" field into the client tracking the last change. During my testing I can't get the plugin to set the Description into the correct client, and if I manually add the field to the client, it does not get read and processed.

      Until this is corrected I can't use polling of each individual checkout.

          [JENKINS-39652] Add support for polling multiple checkouts with pipeline scripts

          Pete McNab created issue -

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java
          src/main/java/org/jenkinsci/plugins/p4/build/P4EnvironmentContributor.java
          src/main/java/org/jenkinsci/plugins/p4/credentials/P4BaseCredentials.java
          src/main/java/org/jenkinsci/plugins/p4/tagging/TagAction.java
          src/main/java/org/jenkinsci/plugins/p4/tasks/AbstractTask.java
          src/test/java/org/jenkinsci/plugins/p4/client/JenkinsfileTest.java
          http://jenkins-ci.org/commit/p4-plugin/ad88e9695891a28332f5e1282698aff18a18f9b7
          Log:
          Multi client support in Pipeline.

          If two or more `p4sync` operations are called in one Pipeline script,
          they MUST have different client names. During a build, multiple
          entries are added to the build history; on subsequent builds they are
          used in the three following situations:

          • Polling: largest change number across all the checkouts is used.
          • Change Summary: last change with the same client name is used.
          • Environment: last change recorded (regardless of client).

          Added two test cases to cover basic multi sync build/poll situations.

          JENKINS-38401
          JENKINS-37462
          JENKINS-39652

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java src/main/java/org/jenkinsci/plugins/p4/build/P4EnvironmentContributor.java src/main/java/org/jenkinsci/plugins/p4/credentials/P4BaseCredentials.java src/main/java/org/jenkinsci/plugins/p4/tagging/TagAction.java src/main/java/org/jenkinsci/plugins/p4/tasks/AbstractTask.java src/test/java/org/jenkinsci/plugins/p4/client/JenkinsfileTest.java http://jenkins-ci.org/commit/p4-plugin/ad88e9695891a28332f5e1282698aff18a18f9b7 Log: Multi client support in Pipeline. If two or more `p4sync` operations are called in one Pipeline script, they MUST have different client names. During a build, multiple entries are added to the build history; on subsequent builds they are used in the three following situations: Polling: largest change number across all the checkouts is used. Change Summary: last change with the same client name is used. Environment: last change recorded (regardless of client). Added two test cases to cover basic multi sync build/poll situations. JENKINS-38401 JENKINS-37462 JENKINS-39652

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java
          src/main/java/org/jenkinsci/plugins/p4/tagging/TagAction.java
          src/main/java/org/jenkinsci/plugins/p4/tasks/AbstractTask.java
          src/test/java/org/jenkinsci/plugins/p4/client/JenkinsfileTest.java
          http://jenkins-ci.org/commit/p4-plugin/fb5235393d8b2a1e44271429876b4910defe2463
          Log:
          Polling fix for Multi client support in Pipeline.

          Jenkins polls for each SCM checkout, so must poll each workplace and
          therefore need to lookup last build information for each sync.
          Polling now uses same lookup as Change Summary.

          Added extra test cases multi sync poll and poll again.

          JENKINS-38401
          JENKINS-37462
          JENKINS-39652

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/PerforceScm.java src/main/java/org/jenkinsci/plugins/p4/tagging/TagAction.java src/main/java/org/jenkinsci/plugins/p4/tasks/AbstractTask.java src/test/java/org/jenkinsci/plugins/p4/client/JenkinsfileTest.java http://jenkins-ci.org/commit/p4-plugin/fb5235393d8b2a1e44271429876b4910defe2463 Log: Polling fix for Multi client support in Pipeline. Jenkins polls for each SCM checkout, so must poll each workplace and therefore need to lookup last build information for each sync. Polling now uses same lookup as Change Summary. Added extra test cases multi sync poll and poll again. JENKINS-38401 JENKINS-37462 JENKINS-39652
          Paul Allen made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Paul Allen made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]

          Paul Allen added a comment -

          Ready for release

          Paul Allen added a comment - Ready for release
          Paul Allen made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Resolved [ 5 ]

          Paul Allen added a comment -

          Released in 1.4.11

          Paul Allen added a comment - Released in 1.4.11
          Paul Allen made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

            p4paul Paul Allen
            pmcnab Pete McNab
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: