Jenkins - 运行 新奴隶连接时的工作

Jenkins - Run job when new slave connects

我有一个 Jenkins 安装使用 SWARM 连接新的从站。 我在 AWS 中启动新实例,它们使用 SWARM 客户端连接到 Jenkins 主服务器并将自己注册为从服务器。

是否可以让 Jenkins Master 检测何时添加了新的从服务器并开始在该从服务器上 运行 一些 "init" 作业?

谢谢

EC2 plugin 会代表您启动奴隶,运行 有一个初始化脚本会为您服务。

Init script is the shell script to be run on the newly launched EC2 instance, before Jenkins starts launching a slave agent. If the AMI doesn't have Java pre-installed, you can do this in the init script. This is also a good place to install additional packages that you need for your builds and tests. The init script is located at /tmp/init.sh and is owned and run by the user account specified in the "Remote User" field (so use of "sudo" may be required for non-root accounts).

我们使用 Slave Setup Plugin 挂载网络驱动器,并在从服务器连接时从主服务器复制一些文件。

如果您想 运行 某些 Jenkins 作业,只要从属(或某个从属)连接,您可以尝试 Startup Trigger Plugin