[英]Unable to connect to master from slave in jenkins with .bat file
I have a command that I use to connect to master from one of my Jenkins agents, I did not want to type the connection command each time I boot the agent, so I created a .bat file:我有一个命令用于从我的一个 Jenkins 代理连接到 master,我不想每次启动代理时都输入连接命令,所以我创建了一个 .bat 文件:
java -jar agent.jar -jnlpUrl http://master_host:8080/computer/Windows%207/slave-agent.jnlp -secret MY_SECRET -workDir "C:\Jenkins"
but there is weird issue, if I type the command manually, it works fine, but if I run the bat file, I am getting error message:但是有一个奇怪的问题,如果我手动输入命令,它工作正常,但是如果我运行 bat 文件,我收到错误消息:
java.io.IOException: Failed to load http://master_host:8080/computer/Windows07/sla
ve-agent.jnlp?encrypt=true: 404 Not Found
does anyone know how to resolve it?有谁知道如何解决它? My agent is Windows 7 machine.
我的代理是 Windows 7 机器。
You can add below to your bat file :- 您可以在下方添加到bat文件:-
cd/d D:\tools\Jenkins (Location where agent.jar)
java -jar agent.jar -jnlpUrl http://master_host:8080/computer/Windows%207/slave-agent.jnlp -secret MY_SECRET -workDir "C:\Jenkins"
And please check the URL of jenkins, if you deployed jenkins on tomcat then url will look like:- 并请检查jenkins的URL,如果您在tomcat上部署了jenkins,则url如下所示:-
http://master_host:8080/jenkins/computer/Windows%207/slave-agent.jnlp -secret MY_SECRET -workDir "C:\Jenkins"
The issue is with the Slave name "Windows 7" try not to have space.问题在于 Slave 名称“Windows 7”尽量不要有空间。 Rename your slave as Windows-7, it will work.
将您的从站重命名为 Windows-7,它将起作用。
http://master_host:8080/computer/Windows%207/slave-agent.jnlp http://master_host:8080/computer/Windows%207/slave-agent.jnlp
You can also avoid this issue by escaping % in the url with another %.您还可以通过使用另一个 % 转义 url 中的 % 来避免此问题。 https://stackoverflow.com/a/13552702
https://stackoverflow.com/a/13552702
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.