The below code use to work when we run it from a freestyle project, but now we are moving the project as a pipeline and it is not working anymore.
Jelly Template:
<j:choose>
<j:when test="${line.contains('Failed test text')}">
Testcase failed when running Failed test text<BR/>
<j:set var="xmlFilePath" value="${build.getWorkspace()}/Tests/TestResults.xml"/>
<util:file name="${xmlFilePath}" var="xmlFileContent"/>
<x:parse var="TextResults" xml="${xmlFileContent}"/>
<x:set var="JmeterTestResults" select="$TestResults/testResults"/>
<x:forEach var="testcaseResult" select="$TestResults/httpSample">
<x:forEach var="assertionResults" select="$testcaseResult/assertionResult">
<j:set var="name"><x:expr select="$assertionResults/name"/></j:set>
<j:set var="failure"><x:expr select="$assertionResults/failure"/></j:set>
<j:if test="${failure.equals('true')}">
<j:set var="failureMessage"><x:expr select="$assertionResults/failureMessage"/></j:set>
${name}<BR/>
${failureMessage}
</j:if>
</x:forEach>
</x:forEach>
</j:when>
</j:choose>
I found that the reason is that running as a pipeline the ${build.getWorkspace()}
is not working anymore, and alternatively i can use ${env.WORKSPACE}
, however also noticed that “env” variables are also not visible for in the jelly side. Also used "${ENV, "var=WORKSPACE"}"
and it does not work too.
In my project once the testing executing is leaving fails descriptions upon some .xml files that i use to collect and display in the notification e-mail.
How can i get now the workspace path ? Any ideas ?