Running a Jenkins job with a node parameter fails to mkdirs

浪尽此生 提交于 2020-01-15 11:47:08

问题


  • 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!