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

Plot plugin doesn't generate chart data when using pipeline

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Blocker Blocker
    • plot-plugin
    • None
    • Jenkins 2.73.3
      Plot Plugin 2.0.0
      Pipeline 2.5

      I have following configuration on freestyle job which will generate chart successfully.

      Then I have pipeline job where I'm using following code which is generated with Snippet Generator using same configurations than in freestyle job:

      plot csvFileName: 'plot-14bd9ae9-09b8-407a-8fb5-fffc0528e2c5.csv', exclZero: false, group: 'RX_Module_1', keepRecords: true, logarithmic: false, numBuilds: '', style: 'line', title: 'P1', useDescr: false, xmlSeries: [file: 'plot.xml', nodeType: 'NODESET', url: '', xpath: '*/*/P1/*'], yaxis: '', yaxisMaximum: '', yaxisMinimum: ''

      For some reason that code doesn't generate data. Generated csv file looks like this:

      "Title","P1"
      "Value","Series Label","Build Number","Build Date","URL"
      So only topics are there but the data lines are missing totally. I'm using exactly same xml file in both jobs.

       

          [JENKINS-48215] Plot plugin doesn't generate chart data when using pipeline

          Reinhold Füreder added a comment - - edited

          I seem to have the same failure symptom for a scripted pipeline using 'plot' step in the shared library (there is no "Plots" item on the left for the job – which I correctly get for a very simple declarative pipeline prototype project), but with a significant difference: the aggregated csv file in the root folder of the job actually contains the expected data

          ***@***:/var/lib/jenkins/jobs/ACME-Pipeline (Branch)$ ll
          total 40
          drwxr-xr-x  3 jenkins unix-user  4096 Dez 14 10:14 ./
          drwxr-xr-x 17 jenkins unix-user  4096 Nov  8 12:17 ../
          drwxr-xr-x 79 jenkins unix-user 12288 Dez 14 10:18 builds/
          -rw-------  1 jenkins unix-user  3843 Dez 14 10:13 config.xml
          lrwxrwxrwx  1 jenkins unix-user    22 Dez 14 10:13 lastStable -> builds/lastStableBuild/
          lrwxrwxrwx  1 jenkins unix-user    26 Dez 14 10:13 lastSuccessful -> builds/lastSuccessfulBuild/
          -rw-------  1 jenkins unix-user     4 Dez 14 10:13 nextBuildNumber
          -rw-r--r--  1 jenkins unix-user   250 Dez 14 10:18 plot-phpstorm-offline-inspection-results.csv
          -rw-r--r--  1 jenkins unix-user   414 Jän 17  2017 scm-polling.log
          -rw-------  1 jenkins unix-user    46 Dez 14 10:14 svnexternals.txt
          
          ***@***:/var/lib/jenkins/jobs/ACME-Pipeline (Branch)$ cat plot-phpstorm-offline-inspection-results.csv
          "Title","Problems"
          "Value","Series Label","Build Number","Build Date","URL"
          "272","Total number of problems","574","1513178474254",""
          "272","Total number of problems","576","1513180551279",""
          "272","Total number of problems","577","1513242820301",""
          

          => Is this related or not? Should I file a dedicated issue for that? Or am I missing something?

          Update: This is due to JENKINS-28981 (the build always failed – on purpose) so it was not shown => even an unstable build suffices to show the Plots => I am therefore going to upvote JENKINS-28981, as it does not sound right to me...

          Reinhold Füreder added a comment - - edited I seem to have the same failure symptom for a scripted pipeline using 'plot' step in the shared library (there is no "Plots" item on the left for the job – which I correctly get for a very simple declarative pipeline prototype project), but with a significant difference: the aggregated csv file in the root folder of the job actually contains the expected data ***@***:/var/lib/jenkins/jobs/ACME-Pipeline (Branch)$ ll total 40 drwxr-xr-x  3 jenkins unix-user  4096 Dez 14 10:14 ./ drwxr-xr-x 17 jenkins unix-user  4096 Nov  8 12:17 ../ drwxr-xr-x 79 jenkins unix-user 12288 Dez 14 10:18 builds/ -rw-------  1 jenkins unix-user  3843 Dez 14 10:13 config.xml lrwxrwxrwx  1 jenkins unix-user    22 Dez 14 10:13 lastStable -> builds/lastStableBuild/ lrwxrwxrwx  1 jenkins unix-user    26 Dez 14 10:13 lastSuccessful -> builds/lastSuccessfulBuild/ -rw-------  1 jenkins unix-user     4 Dez 14 10:13 nextBuildNumber -rw-r--r--  1 jenkins unix-user   250 Dez 14 10:18 plot-phpstorm-offline-inspection-results.csv -rw-r--r--  1 jenkins unix-user   414 Jän 17  2017 scm-polling.log -rw-------  1 jenkins unix-user    46 Dez 14 10:14 svnexternals.txt ***@***:/var/lib/jenkins/jobs/ACME-Pipeline (Branch)$ cat plot-phpstorm-offline-inspection-results.csv "Title","Problems" "Value","Series Label","Build Number","Build Date","URL" "272","Total number of problems","574","1513178474254","" "272","Total number of problems","576","1513180551279","" "272","Total number of problems","577","1513242820301","" => Is this related or not? Should I file a dedicated issue for that? Or am I missing something? Update : This is due to JENKINS-28981 (the build always failed – on purpose) so it was not shown => even an unstable build suffices to show the Plots => I am therefore going to upvote JENKINS-28981 , as it does not sound right to me...

          Same issue here with jenkins 2.102 and plugin version 2.0.2 and a similar setup as Jaakko Finning, ie pipeline job, trying to extract data from a xml file.

          The csv file for the plot is created with the title and column header, but data points are not added.

          Yohann Bénédic added a comment - Same issue here with jenkins 2.102 and plugin version 2.0.2 and a similar setup as Jaakko Finning, ie pipeline job, trying to extract data from a xml file. The csv file for the plot is created with the title and column header, but data points are not added.

          Reinhold Füreder added a comment - - edited

          yobeone In another pipeline example I actually could successfully create plot data based on XML series (see code example below) => I thus suspect the problem to be in the definition of the xmlSeries parameter: e.g. the file is not found/there, or the xpath expression is invalid or does not match.

          This works for me:

          plot(group: 'PHPLOC', title: 'Size: Files',
              csvFileName: 'plot-phploc-files.csv',
              xmlSeries: [[file: 'phploc.xml', nodeType: 'NODESET', xpath: '/phploc/directories|/phploc/files', url: "${env.JOB_URL}%build%/"]],
              style: 'line', yaxis: 'Count',
              keepRecords: false)
          

          Please note the restrictions of the xpath expression and the magic behaviour with respect to Plot plugin and XML Series (see https://github.com/jenkinsci/plot-plugin/blob/master/src/test/java/hudson/plugins/plot/XMLSeriesTest.java)

          Reinhold Füreder added a comment - - edited yobeone In another pipeline example I actually could successfully create plot data based on XML series (see code example below) => I thus suspect the problem to be in the definition of the xmlSeries parameter: e.g. the file is not found/there, or the xpath expression is invalid or does not match. This works for me: plot(group: 'PHPLOC' , title: 'Size: Files' , csvFileName: 'plot-phploc-files.csv' , xmlSeries: [[file: 'phploc.xml' , nodeType: 'NODESET' , xpath: '/phploc/directories|/phploc/files' , url: "${env.JOB_URL}%build%/" ]], style: 'line' , yaxis: 'Count' , keepRecords: false ) Please note the restrictions of the xpath expression and the magic behaviour with respect to Plot plugin and XML Series (see https://github.com/jenkinsci/plot-plugin/blob/master/src/test/java/hudson/plugins/plot/XMLSeriesTest.java )

          Thank you for pointing this out. My problem was indeed with the xml file that was no longer found.

          I guess finding this open blocking request in the issue tracker made me jump to conclusions too quickly.

          If anyone else comes to this page, here is a description of what happened : the code generator from jenkins inserted single quotes around the xml filename, which fails to resolve any ${variable} that the file name actually contained. Manually changing these for double quotes made the whole thing work.

          Yohann Bénédic added a comment - Thank you for pointing this out. My problem was indeed with the xml file that was no longer found. I guess finding this open blocking request in the issue tracker made me jump to conclusions too quickly. If anyone else comes to this page, here is a description of what happened : the code generator from jenkins inserted single quotes around the xml filename, which fails to resolve any ${variable} that the file name actually contained. Manually changing these for double quotes made the whole thing work.

          Based on my experience as well as the comment from yobeone I dare to resolve this issue with "Cannot Reproduce"...

          Reinhold Füreder added a comment - Based on my experience as well as the comment from yobeone I dare to resolve this issue with "Cannot Reproduce"...

            nidaley nidaley
            jfinning Jaakko Finning
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: