简体   繁体   English

了解Jenkins:Jenkins Agent节点需要和controller节点一样的环境吗? 代理究竟是如何工作的?

[英]Understanding Jenkins: does Jenkins Agent nodes require the same environment as controller node? How exactly does agent works?

(master / slave terminology is now controller / agent) (主/从术语现在是 controller/代理)

I am learning about Jenkins build automation and I have trouble understanding how the controller/agent structure works.我正在学习 Jenkins 构建自动化,但我无法理解控制器/代理结构的工作原理。

In my setup, there is a controller Jenkins node on the same computer of the source to be built.在我的设置中,在要构建的源的同一台计算机上有一个 controller Jenkins 节点。 The source consists of gigabytes of data (including the source code, the compiler and some resource data).源由数 GB 的数据组成(包括源代码、编译器和一些资源数据)。 To be precise, the "compiler" is the Unity3D editor (which itself consists of several gigabytes of data) and the "source code" is the scripts and assets of a Unity project.准确地说,“编译器”是 Unity3D 编辑器(它本身包含数 GB 的数据),“源代码”是 Unity 项目的脚本和资产。

The Jenkins job is supposed to run the "compiler" on the "source code" and generate some outputs. Jenkins 作业应该在“源代码”上运行“编译器”并生成一些输出。 In a controller/agent configuration, the process is supposed to be parallelized over multiple agent nodes (Jenkins agents).在控制器/代理配置中,该过程应该在多个代理节点(Jenkins 代理)上并行化。

Now here comes the part I struggle to understand: if I were to setup multiple agent nodes (Jenkins agents) on multiple machines, do I need all those agent machines to have the exact same "compiler" and "source code" on them for Jenkins to work correctly?现在是我难以理解的部分:如果我要在多台机器上设置多个代理节点(Jenkins 代理),我是否需要所有这些代理机器都具有完全相同的“编译器”和“源代码”,用于 Jenkins正常工作?

On one hand, based on my reading it seems there isn't the need to do so and the agent machine only needs a "Jenkins agent" to be set up for everything to work properly.一方面,根据我的阅读,似乎没有必要这样做,代理机器只需要设置一个“Jenkins 代理”即可使一切正常工作。 The agent just "magically" knows about the "compiler" and the "source code" on the remote controller machine, without the need to either install the "compiler" or the synchronize the "source code".代理只是“神奇地”知道远程 controller 机器上的“编译器”和“源代码”,而不需要安装“编译器”或同步“源代码”。

However on the other hand, I just couldn't imagine how is this possible to be done with gigabytes of data involved, to the extent that I am confused about whether my understanding on the reading is correct.但是另一方面,我无法想象涉及到千兆字节的数据怎么可能做到这一点,以至于我对我对阅读的理解是否正确感到困惑。 Even if the "source code" can be transferred "by pieces" the "compiler" must be fully executable and cannot be transferred by piece right?即使“源代码”可以“分段”传输,“编译器”也必须是完全可执行的,不能分段传输,对吧?

Any explanation would be appreciated.任何解释将不胜感激。

I have also been learning Jenkins for game development and, as far as I understand, agents first use is in separating out scheduling vs building.我也一直在学习 Jenkins 用于游戏开发,据我所知,代理首先使用的是将调度与构建分开。 The idea is you have one controller and it can run anywhere, and one or more agents that run on different hardware.这个想法是你有一个 controller 并且它可以在任何地方运行,以及一个或多个在不同硬件上运行的代理。 This way, and when an agent is working, the controller doesn't loose resource to do it's job.这样,当代理工作时,controller 就不会浪费资源来完成它的工作。 You might have just one agent, or a Windows machine and Mac that each build for their respective platforms or any number of agents.您可能只有一个代理,或者一台 Windows 机器和 Mac,它们各自为各自的平台或任意数量的代理构建。 The point is not bogging down the controller.重点不是让 controller 停滞不前。

AFAIK, Jenkins pipelines added parallelism but it is optional there isn't any magic. AFAIK,Jenkins 管道增加了并行性,但它是可选的,没有任何魔力。 For Unreal, there is a product Incredibuild that does distributed compilation but Jenkins wouldn't handle that.对于 Unreal,有一个产品 Incredibuild 可以进行分布式编译,但 Jenkins 无法处理。 A cursory search suggests that Unity does not build a way to support distributed compilation.粗略搜索一下,Unity 并没有构建支持分布式编译的方法。

Note: I haven't done any of this but I think parallel agents could be useful if you had some preprocessing step like down-sampling all your textures.注意:我没有做过任何这些,但我认为如果您有一些预处理步骤(例如对所有纹理进行下采样),并行代理可能会很有用。 You could have parallel actions process different folders across multiple agents, and when the they are all done, it goes back to a non-parallel build.您可以让并行操作跨多个代理处理不同的文件夹,当它们全部完成后,它会返回到非并行构建。 Again, this is not a great example but the point is I think it's up to you to figure out if there are pieces of your process that could be made parallel.同样,这不是一个很好的例子,但关键是我认为由您决定是否有可以并行处理的流程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM