In below script in mail body, I want Triggered line to come in bold, I added a tag for bold but doesn't work, in mail it comes as simple Triggered PdeInterop
// Sending email with the log content and pipeline status
def emailSubject = (system_os == 'Windows') ? "Windows Pipeline Execution: $pipelineStatus" : "Linux Pipeline Execution: $pipelineStatus"
def emailBody = "Rebuilds build #${currentBuild.number}\n"
emailBody += "<pre>[Pipeline] Start of Pipeline\n"
emailBody += "[Pipeline] node\n"
emailBody += "Running on Jenkins in ${env.WORKSPACE}\n"
emailBody += "[Pipeline] {\n\n" // Add OS information to the email body
// Print log content for debugging
println("Log Content:")
println(logContent)
println("updatedLogContent:")
println(updatedLogContent)
// Split log content by lines
def logLines = updatedLogContent.split('\n')
// Iterate through log content to color code pipeline status and process URL lines separately
for (def i = 0; i < logLines.size(); i++) {
def line = logLines[i]
if (line.startsWith(" Triggered")) {
emailBody += "<font face='Calibri (Body)' color='blue'><b>$line</b></font>\n" // Make the "Triggered" line bold
} else if (line.startsWith(" Job URL")) {
emailBody += "<font face='Calibri (Body)' color='blue'>$line</font>\n" // Color the "Job URL" line
// Check if the next line contains "Goto URL"
if (i + 1 < logLines.size() && logLines[i + 1].startsWith(" Goto URL")) {
emailBody += "<font face='Calibri (Body)' color='blue'>" + logLines[i + 1] + "</font>\n" // Include "Goto URL"
i++ // Move to the next line
}
} else if (line.startsWith(" Stage")) {
def status = line.tokenize()[3] // Extracting the status
switch(status) {
case "successfully.":
emailBody += "<font face='Calibri (Body)' color='green'>$line</font>\n"
break
case "UNSTABLE":
emailBody += "<font face='Calibri (Body)' color='yellow'>$line</font>\n"
break
default:
emailBody += "<font face='Calibri (Body)' color='red'>$line</font>\n"
}
} else {
emailBody += "<font face='Calibri (Body)'>$line</font>\n"
}
}
emailBody += "\n[Pipeline] //}</pre>\n" // Add pipeline end
emailext body: emailBody, subject: emailSubject, to: "[email protected]", mimeType: 'text/html'
// Set pipeline result
currentBuild.result = pipelineStatus