简体   繁体   English

无法使用Jenkins在从属服务器上执行Shell脚本

[英]Unable to execute shell script on slave with Jenkins

I am attempting to run JUnit tests on a slave via Jenkins. 我试图通过Jenkins在从属服务器上运行JUnit测试。 Configuration of the slave was successful and the master seems to recognize the slave's workspace but is unable to execute the java command via the "Execute Shell" under Build. 从站的配置成功,并且主站似乎可以识别从站的工作空间,但是无法通过Build下的“ Execute Shell”执行java命令。 There is no pulling down code from source control and so no builds. 没有从源代码管理中提取代码,因此也没有构建。 This is a job intended to just run a test on the slave. 这项工作旨在仅在从属服务器上运行测试。

Building remotely on qa-slave in workspace /home/ubuntu/Desktop
[Desktop] $ /bin/sh -xe /tmp/hudson2639231287347256677.sh
+ ./run.sh
Error: Could not find or load main class org.junit.runner.JUnitCore
Build step 'Execute shell' marked build as failure
Finished: FAILURE

I get the same error if I replace run.sh with 如果我将run.sh替换为相同的错误

java org.junit.runner.JUnitCore OneGateTesting.TestSuiteRunner

I am able to run this locally on the slave. 我可以在从属服务器上本地运行它。

I worked around this issue by giving the "other" group the same permissions as for the owner and group for the folders that contain the test, on the Linux machine. 我通过在Linux机器上为“其他”组赋予与包含该测​​试的文件夹的所有者和组相同的权限来解决此问题。 With this, I didn't have to sudo -u jenkins to run the tests from the master. 这样,我不必sudo -u jenkins即可从主服务器运行测试。 Also I had to include the export CLASSPATH stuff in this test script as it couldn't source the .bashrc file. 我还必须在此测试脚本中包含导出CLASSPATH的内容,因为它无法获取.bashrc文件。

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

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