简体   繁体   English

如何在Jenkins中使用Java变量

[英]How to use Java variables in Jenkins

I have Jenkins job which run auto tests on server and send result to email in html formt. 我有詹金斯(Jenkins)工作,该工作在服务器上运行自动测试并将结果发送到html格式的电子邮件中。 HTML report page copied to ftp using comands HTML报告页面使用命令复制到ftp

robocopy \\\\%vm%\\TEST_AT\\AT-Tool_%build% .\\TA\\ *.html *.version /NFL /R:1 robocopy "\\\\%vm%\\TEST_AT\\AT-Tool_%build%\\report" "\\\\ftp\\ftp\\Projects\\TA\\CI-results\\cd%drop%_patch\\%BUILD_NUMBER%" /E

HTML report contains links to png images like: HTML报告包含指向png图像的链接,例如:

file://ftp/ftp/Projects/TA/CI-results/cd14_patch/185/detailed_report_2-TC__dataset1/pages/screenshots/screen-thread-24-1420740565855.png

HTML report is generated by Java code and images path is a variable HTML报告由Java代码生成,图像路径是变量

I need to attach this .png files in email with HTML report which send my Jenkins job. 我需要将此.png文件附加到带有HTML报告的电子邮件中,以发送我的Jenkins工作。

Is it possible to improve my Jenkins job for sending email with such attachments? 通过发送带有此类附件的电子邮件,是否可以改善我的詹金斯(Jenkins)工作?

You can add a post build step in Jenkins witch will create a ZIP archive. 您可以在Jenkins中添加后期构建步骤,女巫将创建一个ZIP存档。

I my project I'm using shell script for it: 我的项目使用的是Shell脚本:

zip -r ${reports_version}.zip docs source

And for e-mail you can use jenkins e-mail ext plugin https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin 对于电子邮件,您可以使用jenkins e-mail ext plugin https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

It allows you to attache files to e-mail notifications. 它使您可以将文件附加到电子邮件通知。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM