持续集成 jenkins 构建后可以收到邮件通知,但里面的附件没有收到,求大侠帮忙分析原因!!

金圣勋 · 2018年08月15日 · 最后由 arrow 回复于 2018年08月15日 · 2735 次阅读

我采用 jenkins+maven+jmeter 在 linux 搭建测试环境,想通过邮件附件方式通知测试报告。
maven 项目路径:/usr/jsx/apitest,测试后在/usr/jsx/apitest/target/jmeter/html 里生成报告。
jenkins 的项目工作空间:/var/lib/jenkins/jobs/接口测试_maven
项目配置->邮件设置里,附件文件路径采用相对路径,根目录是 jenkins 的项目工作空间,因此附件如下设置:
../../../../../usr/jsx/apitest/target/jmeter/html.20180815-查询书籍.html

结果收到邮件但里面没有附件,log 也没有错误信息。
如果附件文件设置为/usr/jsx/apitest/target/jmeter/html.20180815-查询书籍.html,即绝对路径,log 提示路径错误。

哪位大侠帮忙分析哪里出错?是不是路径有问题?

共收到 2 条回复 时间 点赞

构建日志如下:

由用户 jsx 启动
构建中 在工作空间 /var/lib/jenkins/workspace/接口测试_maven 中
Updating http://svn.91sph.com/svn/sph/server-service at revision '2018-08-15T16:54:34.100 +0800' --quiet
Using sole credentials build/****** in realm ‘http://svn.91sph.com:80 VisualSVN Server’
At revision 21847

Using sole credentials build/****** in realm ‘http://svn.91sph.com:80 VisualSVN Server’
No emails were triggered.
[接口测试_maven] $ /bin/sh -xe /tmp/jenkins2568474232541011686.sh

  • convmv -f gbk -t utf-8 -r --notest /usr/jsx/apitest/src Skipping, already UTF-8: /usr/jsx/apitest/src/test/jmeter/查询书籍.jmx Ready! Script returned: Parsing POMs Established TCP socket on 46136 [apitest] $ /usr/jsx/jdk1.8.0_181/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.12-alpha-1.jar:/usr/jsx/apache-maven-3.5.4/boot/plexus-classworlds-2.5.2.jar:/usr/jsx/apache-maven-3.5.4/conf/logging jenkins.maven3.agent.Maven35Main /usr/jsx/apache-maven-3.5.4 /var/cache/jenkins/war/WEB-INF/lib/remoting-3.23.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.12-alpha-1.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.12-alpha-1.jar 46136 <===[JENKINS REMOTING CAPACITY]===>channel started Executing Maven: -B -f /usr/jsx/apitest/pom.xml install [INFO] Scanning for projects... [INFO] [INFO] ----------------------------< jsx:apitest >----------------------------- [INFO] Building apitest 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ apitest --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /usr/jsx/apitest/src/main/resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ apitest --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ apitest --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 3 resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ apitest --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ apitest --- [INFO] Surefire report directory: /usr/jsx/apitest/target/surefire-reports

T E S T S

Running jsx.apitest.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[JENKINS] Recording test results
[WARNING] Attempt to (de-) serialize anonymous class hudson.maven.reporters.SurefireArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[WARNING] Attempt to (de-) serialize anonymous class hudson.maven.reporters.BuildInfoRecorder$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ apitest ---
[INFO]
[INFO] >>> jmeter-maven-plugin:2.1.0:jmeter (jmeter-tests) > :configure @ apitest >>>
[INFO]
[INFO] --- jmeter-maven-plugin:2.1.0:configure (configure) @ apitest ---
[INFO] -------------------------------------------------------
[INFO] Configuring JMeter...
[INFO] -------------------------------------------------------
[INFO]
[INFO] <<< jmeter-maven-plugin:2.1.0:jmeter (jmeter-tests) < :configure @ apitest <<<
[INFO]
[INFO]
[INFO] --- jmeter-maven-plugin:2.1.0:jmeter (jmeter-tests) @ apitest ---
[INFO]

[INFO] -------------------------------------------------------
[INFO] P E R F O R M A N C E T E S T S
[INFO] -------------------------------------------------------
[INFO] Invalid value detected for . Setting pause to 0...
[INFO]

[INFO]

[INFO] Executing test: 查询书籍.jmx
[INFO] Writing log file to: /usr/jsx/apitest/target/jmeter/logs/查询书籍.jmx.log
[INFO] Creating summariser


[INFO] Created the tree successfully using /usr/jsx/apitest/target/jmeter/testFiles/查询书籍.jmx
[INFO] Starting the test @ Wed Aug 15 16:56:00 CST 2018 (1534323360167)
[INFO] Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
[INFO] summary + 1 in 00:00:01 = 1.6/s Avg: 502 Min: 502 Max: 502 Err: 0 (0.00%) Active: 1 Started: 1 Finished: 0
[INFO] summary + 2 in 00:00:00 = 28.2/s Avg: 31 Min: 29 Max: 33 Err: 2 (100.00%) Active: 0 Started: 1 Finished: 1
[INFO] summary = 3 in 00:00:01 = 4.2/s Avg: 188 Min: 29 Max: 502 Err: 2 (66.67%)
[INFO] Tidying up ... @ Wed Aug 15 16:56:00 CST 2018 (1534323360954)
[INFO] ... end of run
[INFO] Completed Test: 查询书籍.jmx
[INFO]
[INFO] --- xml-maven-plugin:1.0-beta-3:transform (default) @ apitest ---
Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
[INFO] Transforming file: /usr/jsx/apitest/target/jmeter/results/20180815-查询书籍.jtl
[INFO] Transformed 1 file(s).
Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor
[INFO] Transforming file: /usr/jsx/apitest/target/jmeter/results/20180815-查询书籍.jtl
[INFO] Transformed 1 file(s).
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ apitest ---
[INFO] Installing /usr/jsx/apitest/target/apitest-0.0.1-SNAPSHOT.jar to /var/lib/jenkins/.m2/repository/jsx/apitest/0.0.1-SNAPSHOT/apitest-0.0.1-SNAPSHOT.jar
[INFO] Installing /usr/jsx/apitest/pom.xml to /var/lib/jenkins/.m2/repository/jsx/apitest/0.0.1-SNAPSHOT/apitest-0.0.1-SNAPSHOT.pom
[WARNING] Attempt to (de-) serialize anonymous class hudson.maven.reporters.MavenArtifactArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[WARNING] Attempt to (de-) serialize anonymous class hudson.maven.reporters.MavenFingerprinter$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.608 s
[INFO] Finished at: 2018-08-15T16:56:02+08:00
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /usr/jsx/apitest/pom.xml to jsx/apitest/0.0.1-SNAPSHOT/apitest-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving /usr/jsx/apitest/target/apitest-0.0.1-SNAPSHOT.jar to jsx/apitest/0.0.1-SNAPSHOT/apitest-0.0.1-SNAPSHOT.jar
/usr/jsx/apitest/pom.xml is not inside /var/lib/jenkins/workspace/接口测试_maven/usr/jsx/apitest/; will archive in a separate pass
/usr/jsx/apitest/target/apitest-0.0.1-SNAPSHOT.jar is not inside /var/lib/jenkins/workspace/接口测试_maven/usr/jsx/apitest/; will archive in a separate pass
channel stopped
[INFO] Shutdown detected, destroying JMeter process...
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level /usr/jsx/apitest/target/jmeter/html to /var/lib/jenkins/jobs/接口测试_maven/htmlreports/_e7bb9f_e8aea1_e68aa5_e5918a
[htmlpublisher] Archiving at PROJECT level /usr/jsx/apitest/target/jmeter/html1 to /var/lib/jenkins/jobs/接口测试_maven/htmlreports/_e8afa6_e7bb86_e68aa5_e5918a
Email was triggered for: Success
Sending email for trigger: Success
Sending email to: jinshengxun@91sph.com
Finished: SUCCESS

放在 workspace 下面试试,有可能是权限问题

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册