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

HTML Publisher does not allow environment variables in fields

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • htmlpublisher-plugin
    • None
    • Jenkins 2.46.3
      htmlpublisher 1.13
      Windows Server 2012 R2 64-bit
      Java(TM) SE Runtime Environment 1.8.0_66-b18

      When trying to use a parameter or an environment variable in the publisher, the value is taken literally instead of getting evaluated.

      I try using a parameter in the report name and the variable was not evaluated:

      Jenkins Console Log:

      [htmlpublisher] Archiving HTML reports...
      [htmlpublisher] Archiving at PROJECT level C:\Temp\TN-alpha_it\coverage-alpha to C:\PSI-APPS\Jenkins\jobs\DEV\jobs\it\jobs\tn-app_it\htmlreports\OpenCover_-_Code_Coverage_-_${INSTANCE}

       

          [JENKINS-44786] HTML Publisher does not allow environment variables in fields

          Hi Hector - you are correct. Currently only the report directory and index pages fields will expand out variables.

          I've changed this from a bug to an improvement as it's never been designed to expand out the Report Title, however I can see that doing so would be useful.

          I'll add it to the list of things to look into - thanks for bringing it up!

          Richard Bywater added a comment - Hi Hector - you are correct. Currently only the report directory and index pages fields will expand out variables. I've changed this from a bug to an improvement as it's never been designed to expand out the Report Title, however I can see that doing so would be useful. I'll add it to the list of things to look into - thanks for bringing it up!

          Thank you very much. We have a lot of parameterized jobs that have reports and I would like to segregate those reports by instance so this would be awesome to have! Thanks again for all the work.

          Hector Santana added a comment - Thank you very much. We have a lot of parameterized jobs that have reports and I would like to segregate those reports by instance so this would be awesome to have! Thanks again for all the work.

          Larry Cai added a comment -

          we like this feature as well.

          For our case, if we customize the title with "date" inside, then we can download the zip file with timestamp inside.

          Hope u have time to fix it soon.

          Larry Cai added a comment - we like this feature as well. For our case, if we customize the title with "date" inside, then we can download the zip file with timestamp inside. Hope u have time to fix it soon.

          I've made some changes which will hopefully bring you the ability you are both after. I've just some tidy up stuff to sort out and then I'll look at releasing a beta version to the experimental update centre so that I can get some feedback about whether it solves your issues and doesn't break anything in the process!

          Will update details here when that is available. I'll leave the general release of this functionality until after the Christmas period as not wanting to break things whilst I might not be available to fix!

          Richard Bywater added a comment - I've made some changes which will hopefully bring you the ability you are both after. I've just some tidy up stuff to sort out and then I'll look at releasing a beta version to the experimental update centre so that I can get some feedback about whether it solves your issues and doesn't break anything in the process! Will update details here when that is available. I'll leave the general release of this functionality until after the Christmas period as not wanting to break things whilst I might not be available to fix!

          r2b2_nz

          Thank you so much! You are awesome. We both appreciate your hard work. I'll check it out as soon as you release the beta!

          Hector Santana added a comment - r2b2_nz Thank you so much! You are awesome. We both appreciate your hard work. I'll check it out as soon as you release the beta!

          Matthew Pistella added a comment - - edited

          Thanks for working on this! Do you have a timeline for when this might be available? Would this also fix the issue in a pipeline file as well?

          Matthew Pistella added a comment - - edited Thanks for working on this! Do you have a timeline for when this might be available? Would this also fix the issue in a pipeline file as well?

          mpistell hsantana29 I've hit a bit of a snag which is slowing things down a bit when it comes to using parameters for the report name specifically related to the main job page view.

          Currently, for the per-build page, I have a solution which is to add a new "Display Name" field where you can use parameters and this is displayed on the left-nav of the per-build page.

          However, for reasons that appear to be either Jenkins architectural ways of working or my lack of understanding them, this doesn't work very well for the main job page as a) you have to fetch the latest build to get the correct Display Name to show and then b) this appears to be cached and therefore next run the code isn't called to refresh the name of the left nav item on the job page.

          So, my question to you both is (Matthew, I'm not sure if report name parameters is something you are interested in or if it's one of the other fields): would there still be value, from what you know, of having the ability to have Display Name (which allows parameters) for the per-build left nav view, if the job page view was always only just displaying the value provided in Report Name (the non-parameterised one). If there is no real value, then unfortunately the report name will not be able to have any parameters applied at this stage.

          I hope I make sense! Let me know your thoughts so that I can make an informed decision about which way to head

          Richard Bywater added a comment - mpistell hsantana29 I've hit a bit of a snag which is slowing things down a bit when it comes to using parameters for the report name specifically related to the main job page view. Currently, for the per-build page, I have a solution which is to add a new "Display Name" field where you can use parameters and this is displayed on the left-nav of the per-build page. However, for reasons that appear to be either Jenkins architectural ways of working or my lack of understanding them, this doesn't work very well for the main job page as a) you have to fetch the latest build to get the correct Display Name to show and then b) this appears to be cached and therefore next run the code isn't called to refresh the name of the left nav item on the job page. So, my question to you both is (Matthew, I'm not sure if report name parameters is something you are interested in or if it's one of the other fields): would there still be value, from what you know, of having the ability to have Display Name (which allows parameters) for the per-build left nav view, if the job page view was always only just displaying the value provided in Report Name (the non-parameterised one). If there is no real value, then unfortunately the report name will not be able to have any parameters applied at this stage. I hope I make sense! Let me know your thoughts so that I can make an informed decision about which way to head

            r2b2_nz Richard Bywater
            hsantana29 Hector Santana
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: