We are implemented CI/CD pipeline using Jenkins on Performance center (LoadRunner Cloud (SAAS offering)).
Pipeline job post execution results email working fine. So I have added Subject and body content in the pipeline job but getting two different emails like subject and body content one email, PDF results file is another email. Please help on this quire.
below is the code I have used.
pipeline {
agent any
// Define email notification recipients
environment {
EMAIL_RECIPIENTS = 'test@cap.org'
}
stages {
stage('Start_Test') {
steps {
echo 'Starting the load test'
}
}
stage('Load test Execution') {
steps {
echo 'Load test Execution in progress'
// Execute load test
lrcRunTest testId: "286", projectId:'1', sendEmail: true // Do not send email here
}
}
}
post {
always {
script {
// Capture the current time
def executionTime = new Date().format("yyyy-MM-dd HH:mm:ss")
// Email subject
def subject = "UAT | Performance Regression Load Test Results | 2024 Support Release"
// Email body
def body = """
Hi All,
We have successfully executed load tests in UAT Environment below scripts.
Objective: To achieve below volumes for respective scenarios.
Scenario Name:
| Scenario Name | Volume to be achieved (TPH*) |
Execution Time: ${executionTime}
"""
// Send email notification after the execution of the pipeline
emailext(
subject: subject,
body: body,
to: '${EMAIL_RECIPIENTS}',
)
}
}
}
}