简体   繁体   English

Jenkins从属设置-主节点和从属节点都是Linux机器

[英]Jenkins slave set-up - both master and slave nodes are Linux machines

I want to set up a Linux node as a slave to the Jenkins master. 我想将Linux节点设置为Jenkins主服务器的从服务器。 I was going through the tutorial on setting it up for a Linux machine. 我正在阅读有关为Linux机器进行设置的教程

Have master launch slave agent via SSH 通过SSH拥有主启动从属代理

Jenkins has a built-in SSH client implementation that it can use to talk to remote sshd and start a slave agent. Jenkins具有内置的SSH客户端实现,可用于与远程sshd对话并启动从属代理。 This is the most convenient and preferred method for Unix slaves, which normally has sshd out-of-the-box. 这是Unix从属服务器最方便,首选的方法,该方法通常具有现成的sshd。 Click Manage Jenkins, then Manage Nodes, then click "New Node." 单击管理Jenkins,然后单击管理节点,然后单击“新节点”。 In this set up, you'll supply the connection information (the slave host name, user name, and ssh credential). 在此设置中,您将提供连接信息(从属主机名,用户名和ssh凭据)。 Note that the slave will need the master's public ssh key copied to ~/.ssh/authorized_keys. 请注意,从服务器将需要将主服务器的公共ssh密钥复制到〜/ .ssh / authorized_keys。

When it says ~/.ssh/authorized_keys does it mean that I need to have the public key in this location on the node when logged in as a jenkins user (which is the username that the Master uses to log into the slaves)? 当它显示~/.ssh/authorized_keys ,是否表示我以jenkins用户(主服务器用于登录从服务器的用户名)登录时需要在节点上的此位置具有公共密钥?

What does ~ signify? ~代表什么? Which user's home directory are we talking about? 我们正在谈论哪个用户的主目录?

To be precise, 确切地说,

  • the public key to be copied is the public key of the user running the master 要复制的公共密钥是运行主服务器的用户的公共密钥
  • the destination is the .ssh/authorized_keys file of the user on the slave (ie, the user whose credentials you select for the ssh connection on the Jenkins node config page). 目的地是从属用户 (即,您在Jenkins节点配置页面上为ssh连接选择的凭据的用户)的.ssh/authorized_keys文件

The ~ character is expanded by most shells to the current user's home directory (eg, /home/userxyz ). 大多数shell将~字符扩展到当前用户的主目录(例如/home/userxyz )。

~ means the user that is running Jenkins. ~表示正在运行Jenkins的用户。

And yes, ~/.ssh/authorized_keys means authorized_keys for the Jenkins user (the one running on your Jenkins server, not literally jenkins ). 是的, ~/.ssh/authorized_keys对Jenkins用户(在您的Jenkins服务器上运行的,而不是从字面意义上的jenkins )表示经过authorized_keysjenkins

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

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