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

"when changeset" not working in P4 multibranch pipeline with Windows Jenkins Master

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I am following this recent example and it does not seem to work for multibranch P4. All of the echo commands show that the changeset information is fully available, but the when changeset conditional never passes:

      pipeline {  agent { label 'master' }  stages {
         stage("Test changeset"){
              when { changeset "**/Jenkinsfile"}
                  steps{ echo "The changeset test worked!!"}
              }
          stage("Display changeset?") {
            steps {
              script {
                 def changeLogSets = currentBuild.changeSets           for (int i = 0; i < changeLogSets.size(); i++) {
                 def entries = changeLogSets[i].items           for (int j = 0; j < entries.length; j++) {
                     def entry = entries[j]
                     echo "${entry.commitId} by ${entry.author} on ${new Date(entry.timestamp)}: ${entry.msg}"               def files = new ArrayList(entry.affectedFiles)               for (int k = 0; k < files.size(); k++) {
                         def file = files[k]
                         echo " ${file.editType.name} ${file.path}"               }
                  }
                 }
              }
            }
      

      Results:

      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Test changeset)
      Stage "Test changeset" skipped due to when conditional
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Display changeset?)
      [Pipeline] script
      [Pipeline] {
      [Pipeline] echo
      66 by jesse on Tue Nov 05 03:40:41 PST 2019: Polling time adjust
      [Pipeline] echo
       edit //streams/Dev-Jenkins/Jenkinsfile
      [Pipeline] }
      [Pipeline] // script
      [Pipeline] }
      [Pipeline] // stage

      Is this a bug?

        Attachments

          Issue Links

            Activity

            Hide
            p4karl Karl Wirth added a comment -

            Hi Jesse Rapczak - Still working OK for me on a new P4D server on 2.190.2. Maybe this is an OS or sensitivity issue. If you would prefer these answers to be private please email the response to 'support@perforce.com' for my attention:

            Please get me the output from:

            (1) p4 -Ztag info

            (2) p4 -Ztag streams

            (3) p4 print //streams/Dev-Jenkins/Jenkinsfile

            Also in your setup are you using folders to keep the multibranch pipeline in?

            What OS is the Jenkins server running on?

            What OS is the P4D server running on?

            Show
            p4karl Karl Wirth added a comment - Hi Jesse Rapczak - Still working OK for me on a new P4D server on 2.190.2. Maybe this is an OS or sensitivity issue. If you would prefer these answers to be private please email the response to 'support@perforce.com' for my attention: Please get me the output from: (1) p4 -Ztag info (2) p4 -Ztag streams (3) p4 print //streams/Dev-Jenkins/Jenkinsfile Also in your setup are you using folders to keep the multibranch pipeline in? What OS is the Jenkins server running on? What OS is the P4D server running on?
            Hide
            jrapczak Jesse Rapczak added a comment -

            I will send you the output privately via support alias. To answer your other questions:

            I have setup the Multibranch pipeline using the default settings, for the most part. Jenkins has created a top-level job and inside of that are the branch jobs. Each job gets a generated P4 workspace of:

            jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}
            

            Jenkins server OS is Windows 10 Pro

            P4D server OS is P4D/LINUX26X86_64/2019.1/1865205 (2019/10/11)

            Show
            jrapczak Jesse Rapczak added a comment - I will send you the output privately via support alias. To answer your other questions: I have setup the Multibranch pipeline using the default settings, for the most part. Jenkins has created a top-level job and inside of that are the branch jobs. Each job gets a generated P4 workspace of: jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER} Jenkins server OS is Windows 10 Pro P4D server OS is P4D/LINUX26X86_64/2019.1/1865205 (2019/10/11)
            Hide
            p4karl Karl Wirth added a comment - - edited

            Just for anyone watching/finding this. Worked with Jesse and could not get

            **/Jenkinsfile

            to work, but did get

            //DEPOT_NAME/**/Jenkinsfile

            working. Windows Jenkins master connected to Linux P4d.

            Note - Reason for using this - attempting to implement polling exclusions so (for example) artifact submits do not trigger the job.

            Show
            p4karl Karl Wirth added a comment - - edited Just for anyone watching/finding this. Worked with Jesse and could not get **/Jenkinsfile to work, but did get //DEPOT_NAME /**/ Jenkinsfile working. Windows Jenkins master connected to Linux P4d. Note - Reason for using this - attempting to implement polling exclusions so (for example) artifact submits do not trigger the job.
            Hide
            p4karl Karl Wirth added a comment -

            Confirm this is a bug/feature of a Jenkins Windows master. If I use

            **/Jenkinsfile

            it does not find the changeset. As far as I can see we are populating the record correctly so this needs to be raised with CloudBees. It's either a bug or quirk of the syntax.

            Show
            p4karl Karl Wirth added a comment - Confirm this is a bug/feature of a Jenkins Windows master. If I use **/Jenkinsfile it does not find the changeset. As far as I can see we are populating the record correctly so this needs to be raised with CloudBees. It's either a bug or quirk of the syntax.
            Hide
            p4karl Karl Wirth added a comment -

            There is possibly a bug here but it's outside the p4-plugin code. It's also posssible a different syntax is needed for Windows.

             Marking as Won't fix for now as there isn't an 'unable to fix' category.

            Show
            p4karl Karl Wirth added a comment - There is possibly a bug here but it's outside the p4-plugin code. It's also posssible a different syntax is needed for Windows.  Marking as Won't fix for now as there isn't an 'unable to fix' category.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              jrapczak Jesse Rapczak
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: