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

email-ext showPaths does not work with p4-plugin

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • p4-plugin
    • None
    • Jenkins ver. 1.565.2
      Email-ext 2.38.2
      P4 1.0.15

      We use email-ext plugin for email notification. For some reason changes are blank when specifying: ${CHANGES_SINCE_LAST_SUCCESS, showPaths=true}. If I just do ${CHANGES_SINCE_LAST_SUCCESS}. showPaths works with perforce-plugin, so that's why I think there may be a bug here.

          [JENKINS-25085] email-ext showPaths does not work with p4-plugin

          Paul Allen added a comment -

          Happy to try and support this, but I'm going to need a lot more to go on here.

          The change data is recorded in the XML files; the parser is there. I'm guessing that an enhancement is needed in the email-ext plugin to access/read the new format.

          Paul Allen added a comment - Happy to try and support this, but I'm going to need a lot more to go on here. The change data is recorded in the XML files; the parser is there. I'm guessing that an enhancement is needed in the email-ext plugin to access/read the new format.

          swolk added a comment -

          Hi Paul, email-ext relies on your P4ChangeEntry.getAffectedPaths and P4ChangeEntry.getAffectedFiles methods. If getAffectedFiles is not implemented as is the case here, then getAffectedPaths is used. From my testing, getAffectedPaths is not returning any values, can you check that? Also, since getAffectedPaths relies on paths relative to workspace which is not really what I want, can you you just implement getAffectedFiles, which could just return getFiles value?

          swolk added a comment - Hi Paul, email-ext relies on your P4ChangeEntry.getAffectedPaths and P4ChangeEntry.getAffectedFiles methods. If getAffectedFiles is not implemented as is the case here, then getAffectedPaths is used. From my testing, getAffectedPaths is not returning any values, can you check that? Also, since getAffectedPaths relies on paths relative to workspace which is not really what I want, can you you just implement getAffectedFiles, which could just return getFiles value?

          Paul Allen added a comment -

          I'll see what I can implement.

          My concern is that I don't want to store 1000s files in the Jenkins XML like the old plugin. As the data is in Perforce, all I have been storing is the change numbers, then I can look the files up as needed.

          Paul Allen added a comment - I'll see what I can implement. My concern is that I don't want to store 1000s files in the Jenkins XML like the old plugin. As the data is in Perforce, all I have been storing is the change numbers, then I can look the files up as needed.

          swolk added a comment - - edited

          Downgrading this to minor. I worked around this issue by creating a groovy email template and calling it in my email-ext configuration via ${SCRIPT} token. Here is the script if anyone is curious:

          <%
          
          def firstIncludedBuild = build
          
          def prev = build.previousBuild
          while (prev != null && prev.result != Result.SUCCESS) {
            firstIncludedBuild = prev
            prev = prev.previousBuild
          }
          
          def startBuild = firstIncludedBuild
          def endBuild = build
          def currentBuild = startBuild
          def builds = []
          
          while (currentBuild != endBuild) {
            builds.add(currentBuild)
            currentBuild = currentBuild.nextBuild
          }
          builds.add(currentBuild)
          
          builds.each() { b ->
          %>Changes for build <%= b.number %>:
          <%
            def changeSet = b.changeSet
            if (changeSet != null && !changeSet.isEmptySet()) {
              changeSet.each() { c ->
          %>  Change <%= c.id %> by <%= c.author %>: <%= c.msg %><%
                c.files.each() { p ->
          %>\t<%= p %>
          <%
                }%>
          <%
              }%><%
            } else {
          %>No changes
          
          <%
            }%>
          <%
          }
          %>
          

          swolk added a comment - - edited Downgrading this to minor. I worked around this issue by creating a groovy email template and calling it in my email-ext configuration via ${SCRIPT} token. Here is the script if anyone is curious: <% def firstIncludedBuild = build def prev = build.previousBuild while (prev != null && prev.result != Result.SUCCESS) { firstIncludedBuild = prev prev = prev.previousBuild } def startBuild = firstIncludedBuild def endBuild = build def currentBuild = startBuild def builds = [] while (currentBuild != endBuild) { builds.add(currentBuild) currentBuild = currentBuild.nextBuild } builds.add(currentBuild) builds.each() { b -> %>Changes for build <%= b.number %>: <% def changeSet = b.changeSet if (changeSet != null && !changeSet.isEmptySet()) { changeSet.each() { c -> %> Change <%= c.id %> by <%= c.author %>: <%= c.msg %><% c.files.each() { p -> %>\t<%= p %> <% }%> <% }%><% } else { %>No changes <% }%> <% } %>

          Jason Davis added a comment -

          I sort of disagree with this being a minor, but I also can't see myself making this a major. Long term, it's not practical to schlep around a groovy script in your environment and with email-ext all but the defacto standard for sharing info by email, something should be done to provide info to that option, because giving recipients a heads up on what actually was affected immediately in the email vs. looking it up has value. Agreed though - who needs 1000s of records in the email? Maybe the plugin could supply the first 20 paths to showpaths and mention on row 21 "Only 20 paths shown, for additional info, review the changeset number in directly in Perforce..."

          Jason Davis added a comment - I sort of disagree with this being a minor, but I also can't see myself making this a major. Long term, it's not practical to schlep around a groovy script in your environment and with email-ext all but the defacto standard for sharing info by email, something should be done to provide info to that option, because giving recipients a heads up on what actually was affected immediately in the email vs. looking it up has value. Agreed though - who needs 1000s of records in the email? Maybe the plugin could supply the first 20 paths to showpaths and mention on row 21 "Only 20 paths shown, for additional info, review the changeset number in directly in Perforce..."

            p4paul Paul Allen
            swolk swolk
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: