使用 Hudson 远程运行批处理文件

发布于 2024-09-26 05:44:01 字数 1071 浏览 3 评论 0 原文

使用 Hudson(最新和最好的版本)安排批处理文件在远程计算机上运行的最简单方法是什么?我正在探索主从设置。我创建了一个哑从机,但我不确定参数应该是什么,以便我可以触发远程从机中的批处理文件。

基本上,我试图在两台不同的远程计算机上按顺序运行 2 个不同的批处理文件,从我的计算机(主计算机)触发。 Hudson 网站上的分步指南是一个死链接。 SO 上也发布了类似的问题,但当我使用他们提到的参数时,它对我来说不太有效。 如果有人做过类似的事情,请提出使这项工作有效的方法。 (我知道如何设置作业,并添加一个步骤来运行批处理文件等,我在配置时遇到问题是在内置功能中使用 hudson 在远程计算机上执行此操作)

更新

谢谢大家的建议。对此的快速更新: 我想要完成的是部分工作,以下是实现它的步骤 -

  1. 从管理节点创建新节点 ->新节点->将执行器数设置为 1,将远程 FS 根设置为“/var/hudson”,将启动方法设置为使用 JNLP,设置 Slavename 并保存。

  2. 一旦设置了从机(从主机),我登录到从机物理机,从 http://masterserver:port/jnlpJars/slave.jar,并从下载位置的命令行运行以下命令 -> java -jar _slave.jar -jnlpUrl http://masterserver:port/computer/slavename/slave -agent.jnlp。连接成功。

  3. 在Master作业配置中勾选“限制此项目可以运行的位置”,并将参数设置为slavename。

  4. 选中“添加构建步骤”以添加我的批处理作业脚本

  5. 我现在仍然缺少的是一种从一个连接到2个从站的方法依次作业,这可能吗?

What is the simplest way to schedule a batch file to run on a remote machine using Hudson (latest and greatest version)? I was exploring the master slave setup. I created a dumb slave but I am not sure what the parameters should be so that I can trigger the batch file in the remote slave machine.

Basically, I am trying to run 2 different batch files on two different remote machines sequentially, triggered from my machine (the master). The Step by step guide on the Hudson website is a dead link. There are similar questions posted on SO but it does not quite work for me when I use the parameters they mention.
If anyone has done something similar please suggest ways to make this work.
(I know how to set up jobs, and add a step to run a batch file etc what I am having trouble configuring is doing this on a remote machine using hudson in built features)

UPDATE

Thank you all for the suggestions. Quick update on this:
What I wanted to get done is partially working, below are the steps followed to get to it -

  1. Created new Node from Manage Nodes -> New Node -> set # of Executors as 1, Remote FS root set as '/var/hudson', set Launch method as using JNLP, set slavename and saved.

  2. Once slave was set up (from master machine), I logged into the Slave physical machine, I downloaded the _slave.jar from http://masterserver:port/jnlpJars/slave.jar, and ran the following from command line at the download location -> java -jar _slave.jar -jnlpUrl http://masterserver:port/computer/slavename/slave-agent.jnlp. The connection was made successfully.

  3. Checked 'Restrict where this project can be run' in the Master job configuration, and set paramater as slavename.

  4. Checked "Add Build Step" for adding my batch job script

  5. What I am still missing now is a way to connect to 2 slaves from one job in sequence, is that possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

画离情绘悲伤 2024-10-03 05:44:01

这是相当简单和直接的。假设您已经有一个正在运行的奴隶。然后,您可以像在本地目标机器上一样配置作业。 限制此项目可以运行的位置的设置需要是您想要的节点。这就是作业配置的全部内容。

对于从站配置,请阅读以下页面。

  1. 将 Hudson 安装为 Windows 服务
  2. < a href="http://wiki.hudson-ci.org/display/HUDSON/Distributed+builds#Distributedbuilds-Differentwaysofstartingslaveagents" rel="nofollow">分布式构建

在 Windows 上,我更喜欢将从站作为服务并让远程机器管理从机的启动和关闭。这样做的唯一缺点是,每次更新服务器时都需要升级客户端只需从服务器获取新的client.jar,升级后并将其放在从属服务器上即可。然后重启slave就大功告成了。

即使我以本地管理员身份进行安装,但我在使用从属服务器的安装即服务选项时遇到了麻烦。然后我使用 srvany 将 jar 包装到服务中。 这是一个关于它的博客。您需要包装的命令,您将从从属页面的 Hudson 服务器获取。为了使所有这些工作正常,您应该将从属管理设置为 jnlp。

如果目标计算机上有 ssh 服务器,则可以使用 ssl 从设置。这些对我来说就像一种魅力。我将它们与我的 UNIX 从属设备一起使用。到目前为止,与 Windows 服务客户端相比,unix 的 ssl 选项没有那么麻烦。

It is fairly easy and straight forward. Lets assume you already have a slave running. Then you configure the job as if you are locally on the target box. The setting for Restrict where this project can be run needs to be the node that you want to on. This is all for the job configuration.

For the slave configuration read the following pages.

  1. Installing Hudson as a Windows service
  2. Distributed builds

On windows I prefer to run the slave as a service and let the remote machine manage the start up and shut down of the slave. The only disadvantage with this is, you need to upgrade the client every time you update the server Just get the new client.jar from the server, after the upgrade and put it on the slave. Then restart the slave and you are done.

I had troubles using the install as a service option for the slave even though I did it as a local administrator. I used then srvany to wrap the jar into a service. Here is a blog about it. The command that you need to wrap, you will get from your Hudson server from the slave page. For all of this to work, you should set up the slave management as jnlp.

If you have an ssh server on your target machine, you can use the ssl slave settings. These work for me like a charm. I use them with my unix slaves. So far the ssl option with unix is less of an hassle, than the windows service clients.

不及他 2024-10-03 05:44:01

我在从属设置方面遇到了一些类似的问题,并写了这篇博客文章< /a> - 我在 Linux 而不是 Windows 上运行,但希望这会有所帮助。

I had some similar trouble with slave setup and wrote up this blog post - I was running on Linux rather than Windows, but hopefully this will help.

情愿 2024-10-03 05:44:01

我不知道如何使用内置的 hudson 功能来完成这项工作 - 但在我的一个项目构建中,我运行一个批处理文件,该文件又使用 PSTools
在远程服务器上运行作业。我发现 PS 工具非常易于使用 - 下载、解压并使用正确的参数运行命令,因此选择使用它。

I dont know about how to use built-in hudson features for this job - but in one of my project builds, i run a batch file that in turn uses PSTools
to run the job on a remote server. I found PS tools extremely easy to use - download, unpack and run the command with the right parameters, hence opted to use this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文