This is a piece of my Jenkinsfile:
emailext([
attachmentsPattern: '**/build/*.log',
subject: 'Hello World',
recipientProviders: [developers(), requestor()],
to: '$DEFAULT_RECIPIENTS',
body: '''
<p>Test summary:</p>
<ul>
<li><a href="${BUILD_URL}">Status: ${BUILD_STATUS}</a></li>
<li><a href="${BUILD_URL}/flowGraphTable">Executed steps</a></li>
<li><a href="${BUILD_URL}/parsed_console">Errors and warnings</a></li>
<li>Test results:</li>
${testResults}
</ul>
''',
mimeType: 'text/html'
])
But unfortunately testResults
variable doesn’t get interpolated:
How can I fix?
Also, I have tried to replace '''
with """
, like this:
emailext([
attachmentsPattern: '**/build/*.log',
subject: 'Hello World',
recipientProviders: [developers(), requestor()],
to: '$DEFAULT_RECIPIENTS',
body: """
<p>Test summary:</p>
<ul>
<li><a href="${BUILD_URL}">Status: ${BUILD_STATUS}</a></li>
<li><a href="${BUILD_URL}/flowGraphTable">Executed steps</a></li>
<li><a href="${BUILD_URL}/parsed_console">Errors and warnings</a></li>
<li>Test results:</li>
${testResults}
</ul>
""",
mimeType: 'text/html'
])
But I got this error in my Jenkins console output:
Error when executing always post condition:
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 4fb4675f-4b24-4e5a-8344-835e9d514202
groovy.lang.MissingPropertyException: No such property: BUILD_STATUS for class: groovy.lang.Binding