Running a Jenkins job with a node parameter fails

2019-08-02 06:53发布

  • 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. Image

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

3条回答
看我几分像从前
2楼-- · 2019-08-02 07:19

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.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-08-02 07:20

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.
查看更多
疯言疯语
4楼-- · 2019-08-02 07:34

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.

查看更多
登录 后发表回答