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

clicking HTML Report link logs user out of Hudson, goes to other job

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • clover-plugin
    • None
    • Platform: All, OS: All

      Hello! I have been really enjoying the Clover plugin. However recently I tried
      to split out a job into parts to run faster and aggregate into a master job, and
      had problems. Here's how I did it:

      1. Create a job, foo-coverage, which generates clover coverage xml and html, and
      enable the Clover plugin, pointing it at the XML. Everything works perfectly for
      this project including the HTML link.

      2. Now, trigger foo-coverage from the master job, and grab the xml and a zip of
      the html from the workspace, unzipping and putting these in the workspace of the
      master. Enable the Clover plugin in the master, pointing it at the XML.

      This is where the problem happens. It picks up on the XML just fine and shows
      the summary. However when I click the HTML link on the master project, I get
      logged out AND sent to the summary page for foo-coverage (with no coverage
      available), even though I clicked from the master.

      Somehow Clover is getting mixed up about these jobs I think. I looked in the XML
      file and there is no reference to the foo-coverage that I can see.

          [JENKINS-4944] clicking HTML Report link logs user out of Hudson, goes to other job

          mcrooney added a comment -

          Okay, I figured out the cause of problem, but not why it actually behaves this way. It was because the root of my workspace had an unrelated index.html file in it, so Clover archived my entire workspace for each build! Then this resulted in quite buggy behavior when clicking the HTML report. Now that I've removed the other index.html, Clover correctly finds the actual Clover HTML directory and displays/archives that. However it seems like it could do a better job of detecting the coverage directory and why it was logging me out and taking me to another project seems like a bug as well, but at least it isn't happening to me anymore.

          mcrooney added a comment - Okay, I figured out the cause of problem, but not why it actually behaves this way. It was because the root of my workspace had an unrelated index.html file in it, so Clover archived my entire workspace for each build! Then this resulted in quite buggy behavior when clicking the HTML report. Now that I've removed the other index.html, Clover correctly finds the actual Clover HTML directory and displays/archives that. However it seems like it could do a better job of detecting the coverage directory and why it was logging me out and taking me to another project seems like a bug as well, but at least it isn't happening to me anymore.

          In my opinion the behavior is correct. It looks for the directory containing index.html file in the coverage report directory:

          private boolean copyHtmlReport(FilePath coverageReport, FilePath buildTarget, TaskListener listener) throws IOException, InterruptedException {
              // Copy the HTML coverage report
              final FilePath htmlIndexHtmlPath = findOneDirDeep(coverageReport, "index.html");

          and the coverageReport argument is set to:

          String reportDir = env.expand(cloverReportDir);
          FilePath coverageReportDir = workspace.child(reportDir);
          

          where the cloverReportDir is a folder specified in "Clover report directory" option in UI.

          So in case you have an empty value in it and an index.html file in the workspace root, Clover will copy the entire workspace.

          In order to fix it you simply have to specify a correct folder containing HTML report.

          Marek Parfianowicz added a comment - In my opinion the behavior is correct. It looks for the directory containing index.html file in the coverage report directory: private boolean copyHtmlReport(FilePath coverageReport, FilePath buildTarget, TaskListener listener) throws IOException, InterruptedException { // Copy the HTML coverage report final FilePath htmlIndexHtmlPath = findOneDirDeep(coverageReport, "index.html" ); and the coverageReport argument is set to: String reportDir = env.expand(cloverReportDir); FilePath coverageReportDir = workspace.child(reportDir); where the cloverReportDir is a folder specified in "Clover report directory" option in UI. So in case you have an empty value in it and an index.html file in the workspace root, Clover will copy the entire workspace. In order to fix it you simply have to specify a correct folder containing HTML report.

            marekparf Marek Parfianowicz
            mcrooney mcrooney
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: