diff --git a/Jenkinsfile b/Jenkinsfile index 3c9ba9b..8ed6be4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,6 +20,23 @@ pipeline { //} stages { + stage('email'){ + echo "测试发送邮件" + // 设置生成模板文件 + configFileProvider([configFile(fileId: ' Extended-Email-Publisher', + targetLocation: 'email.html', + variable: 'failt_email_template')]) { + // 读取模板 + template = readFile encoding: 'UTF-8', file: "${failt_email_template}" + // 发送邮件 + emailext(subject: '任务执行失败', + attachLog: true, + recipientProviders: [requestor()], + to: '32*****47@qq.com', + body: """${template}""") + } + } + stage('Build') { steps { sh 'echo "Hello World"'