问题
- I have added a Android Node in Jenkins.
- Now I am trying to run a Job with the Node as parameter
- It fails to mkdirs in workspace
- If i remove the Node as parameter, the Job runs fine
Plese find the screenshot for the Node I created.
Log:
- Loading node environment variables.
Building remotely on Android in workspace /var/lib/jenkins/workspace/AndroidT
[WS-CLEANUP] Deleting project workspace...
java.io.IOException: Failed to mkdirs: /var/lib/jenkins/workspace/AndroidT
at hudson.FilePath.mkdirs(FilePath.java:1191)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1267)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1741)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE
回答1:
I finally found the solution.
Jenkins is using 'jenkins' user for auomation, but i had run the java command java -jar slave.jar -jnlpUrl http://IP/computer/Android/slave-agent.jnlp -secret dadasdasdasd
tostart the node with another user.
I switched the user to jenkins, ran the command and the issue is fixed.
回答2:
I'm not sure you intend to put your workspace in /var/lib/jenkins, since you probably don't have permissions to the path and it's not really for user files.
Instead, you should specify a workspace path that your executor should have access to. Look through the output of your successful, unspecified-node job and find the path to the workspace it was referring to, as in line 2:
Building remotely on Android in workspace /var/lib/jenkins/ workspace/AndroidT
then use that path before /workspace as your node's remote root directory.
回答3:
Don't forget the most basic reason that something cannot be written to disk:
- The user that running the Jenkins agent does not have write permission to your workspace
/var/lib/jenkins/workspace/
- The disk is full. This is what happened to me.
来源:https://stackoverflow.com/questions/42854961/running-a-jenkins-job-with-a-node-parameter-fails-to-mkdirs