诱惑力报告没有附在Jenkins的电子邮件上。我正在使用Jenkins管道脚本,这是我的脚本,但是这是我在电子邮件中遇到的错误:
Groovy模板文件的诱惑力-Report.groovy没有在$JENKINS_HOME/email-模板中找到。
另外,我在电脑里找不到allure-report.groovy
。
这是我的Jenkins管道,我不知道如何包含模板:
pipeline {
agent {
label {
label ""
customWorkspace "/john/qa-end-to-end"
}
}
tools {nodejs "node"}
stages {
stage('Checkout App') {
steps {
dir("${env.HOME}/app") {
echo "Building.."
sh 'git reset --hard HEAD'
sh 'git clean -f -d'
sh 'git pull'
}
}
}
stage('Starting Tests') {
steps {
echo "Starting End to End Tests"
dir("${env.HOME}/qa-end-to-end/") {
sh './tests.sh'
}
}
}
}
post('Publish Report') {
always {
script {
allure([
includeProperties: false,
jdk: '',
properties: [],
reportBuildPolicy: 'ALWAYS',
results: [[path: '$WORKSPACE/${env.HOME}/app/target/allure-results']]
])
}
}
failure {
emailext(
attachmentsPattern: "$WORKSPACE/${env.HOME}/qa-end-to-end/allure-report/index.html",
body: '''${SCRIPT, template="allure-report.groovy"}''',
subject: "Failure in End to End Tests -> Build Number: ${env.BUILD_NUMBER}",
from: "john@gmail.com",
to: "mike@gmail.com"
)
}
}
}
发布于 2020-07-07 01:05:29
$JENKINS_HOME/email-templates
用于放置电子邮件正文模板,通常在安装像email
这样的Jenkins插件时,它包含一些预定义的模板,这些模板在插件安装后将被解压到$JENKINS_HOME/email-templates
中。
当您在job中使用send email
时,您可以选择使用插件模板之一,Jenkins将尝试从文件夹$JENKINS_HOME/email-templates
获取模板
如果您想使用自模板,也需要将其放入$JENKINS_HOME/email-templates
中。
使用自定义脚本(那些没有与email-ext一起打包的脚本)需要詹金斯管理员的合作。这些步骤相对简单:
https://stackoverflow.com/questions/62762030
复制相似问题