How to output the project properties to the build XML logs so that they can be used in XSL files?

StackOverflow https://stackoverflow.com/questions/7184697

  •  12-01-2021
  •  | 
  •  

Question

We use cruisecontrol for our daily automatic tests. We use the JUnit framework. For every case, we have an output file other than the log file of the junit case. We add the output files to the artifact directory of the project when the build completes. We use the built-in XSL file "unittests.xsl" to publish the email results. Recently, I want to modify the xsl file "unittests.xsl" to add a hyperlink to the output file for every case. Here is what I tried at the very beginning:

<td class="unittests-data" width="300">
    <a href="{concat('artifacts/',$projectname,'/',$cctimestamp,'/autotest_logs/',..//..//@name,'_',..//@name,'.log')}"><xsl:value-of select="..//@name"/></a>
</td>

The problem here is, the url of the output file can work when opening the result page using the web browser; but the url is incorrect in the result mail. In the mail, the url is concated as: http://localhost:18080/cruisecontrol/buildresults/artifacts/...

But what I want is:

http://localhost:18080/cruisecontrol/artifacts/...

So I am thinking of another way to solve this. My thought was to output a property of the root url to the project logs so that the XSL file can get its value like this:

<xsl:variable name="urlroot" select="/cruisecontrol/info/property[@name='urlroot']/@value"/>
<td class="unittests-data" width="300">
    <a href="{concat($urlroot,'artifacts/',$projectname,'/',$cctimestamp,'/autotest_logs/',..//..//@name,'_',..//@name,'.log')}"><xsl:value-of select="..//@name"/></a>
</td>

The problem here is, the properties of the project (defined in config.xml) are not outputed to the project logs. So that I can not do it this way.

Is there any other way to achieve this? Thanks in advance.

Était-ce utile?

La solution

  1. Create a xml file to hold the properties you need to have in the CC publishing phase
  2. Fill out the xml file with the properties during the build
  3. Copy the file to the CC merge directory at the end of the build
  4. Target the property values in the xsl transformer

If you echo the properties to the CC log during the build then they end up in an unpredictable location in the CC log. A reliable way is to create an xml file specifically for the stuff you need and merge it into the log at the end. Now you may reliably target the values in the xsl.

Autres conseils

You can simply pass the properties to some antbuilde and echo them. Then when you merge your log files the property values will be in it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top