# HTML Publisher does not allow environment variables in fields

XMLWordPrintable

#### Details

• Type: Improvement
• Status: In Progress
• Priority: Major
• Resolution: Unresolved
• Component/s:
• Labels:
None
• Environment:
Jenkins 2.46.3
htmlpublisher 1.13
Windows Server 2012 R2 64-bit
Java(TM) SE Runtime Environment 1.8.0_66-b18
• Similar Issues:

#### Description

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}

31 kB

#### Activity

Hide
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!

Show
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!
Hide
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.

Show
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.
Hide
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.

Show
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.
Hide
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!

Show
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!
Hide
Hector Santana added a comment -

Richard Bywater

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!

Show
Hector Santana added a comment - Richard Bywater 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!
Hide
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?

Show
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?
Hide
Richard Bywater added a comment -

Matthew Pistella Hector Santana 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

Show
Richard Bywater added a comment - Matthew Pistella Hector Santana 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

#### People

• Assignee:
Richard Bywater
Reporter:
Hector Santana