简体   繁体   中英

Unable to execute shell script on slave with Jenkins

I am attempting to run JUnit tests on a slave via Jenkins. 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. 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

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. With this, I didn't have to sudo -u jenkins to run the tests from the master. Also I had to include the export CLASSPATH stuff in this test script as it couldn't source the .bashrc file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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