詹金斯(Jenkins)-在主站和从站中同时执行一项工作 [英] Jenkins - Running a single job in master as well as slave

查看:89
本文介绍了詹金斯(Jenkins)-在主站和从站中同时执行一项工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个主服务器(linux)和一个Windows从属服务器,我想在主服务器和从属服务器上构建一个作业. 限制在哪里可以运行该项目"选项允许我们将作业绑定到特定的从站,但是是否可以将一个作业绑定到主站和从站?如何配置构建步骤",因为在Windows上运行它需要使用Windows批处理命令进行构建,而Linux需要使用shell命令.例如,即使作业尝试在主服务器和从服务器上运行,它也会不会在某一时刻失败,因为将同时执行两个构建选项(使用batch和shell命令)?

I have a master (linux) and a windows slave set up, and would like to build a single job both on the master and the slave. The "Restrict where this project can be run" option allows us to bind the job to a particular slave but is it possible to bind one job to the master as well as slave? How would one configure the "Build Step" since running it on Windows requires a build with Windows batch command and Linux requires shell command. For example even if the job tries to run on master and slave, wouldn't it fail at one point since both the build options (with batch and shell command) will be executed?

推荐答案

好,在Jenkins中,您可以创建机器组(主机或从机)来实现:

Well, in Jenkins you can create groups of machine (either master or slaves), to do this :

  • 单击jenkins第一页上的计算机名称
  • 进入节点配置菜单
  • 然后,您可以在标签"字段中输入一些标签.让我们添加一个mutli_platform标签为例
  • 返回Jenkins的第一页
  • 为您需要在其上运行作业的每台计算机执行此操作
  • 返回Jenkins的第一页
  • 单击要在多个节点上运行的作业
  • 进入配置菜单
  • 检查Restrict where this project can be run并将mutli_platform放入其中.
  • click on the machine name on the first page of jenkins
  • enter in the node configuration menu
  • then, you can enter some labels in the Labels field. Let's add a mutli_platform label for example
  • go back to the first page of Jenkins
  • do it for each machine on which you need to run the job
  • go back to the first page of Jenkins
  • click on the job you want to run on multiple nodes
  • go in the configuration menu
  • check the Restrict where this project can be run and put the mutli_platform in it.

然后,您的构建将可以在mutli_platform标签上运行.

Then, your build will be able to run on the mutli_platform label.

第二部分是多平台脚本,您可以使用ant构建或python构建(通过

For the second part, the multi-platform script, you can use ant builds, or python builds (with the python plugin).

如果需要在2个(或更多)平台上构建,则应使用

If you need to build on the 2 (or more) platforms, you should use a Matrix Job. You will be able to create a job and force it to run on every slave you need.

这篇关于詹金斯(Jenkins)-在主站和从站中同时执行一项工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆