我在哪里可以找到文件系统上 jenkins 配置中的 "Enable Agent → Master Access Control" 选项?

Where do I find the "Enable Agent → Master Access Control" option in jenkins config on file system?

我正在 docker swarm 上设置一个 jenkins 服务。在我的图像中,我正在为 jenkins 提供基本配置(包括 config.xmlproxy.xml、...)。我想让"Configure global security"下的"Enable Agent → Master Access Control"选项默认开启,那么在哪个配置文件里设置什么呢?

我在我的 docker swarm 中启动了一个没有那个开关的 jenkins 服务,通过网络界面打开了这个选项并检查了 ${JENKINS_HOME}/config.xml 但我在 config.xml 中找不到任何听起来像的东西喜欢我想要的选项。

"Enable Agent → Master Access Control" 选项应该通过配置文件打开。任何人都可以建议吗?

$JENKINS_HOME/secrets/slave-to-master-security-kill-switch 是您要查找的文件。

摘自official doc

基本上有三种启用访问控制机制的方法:

  • 通过网络 UI,转到 http:///jenkins/configureSecurity 并选中“启用代理 → 主访问控制”选项。
  • 通过文件系统,创建或编辑文件$JENKINS_HOME/secrets/slave-to-master-security-kill-switch使其包含false.
  • 使用 Groovy 钩子脚本并执行如下操作:
import jenkins.security.s2m.AdminWhitelistRule
import jenkins.model.Jenkins
Jenkins.instance.getInjector().getInstance(AdminWhitelistRule.class)
.setMasterKillSwitch(false)