在Mac OS上设置jenkins slave [英] Setting up jenkins slave on Mac OS

查看:381
本文介绍了在Mac OS上设置jenkins slave的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对在Mac上设置Jenkins slave感到困惑. Google似乎对Java Web Start选项(

I'm confused about setting up Jenkins slave on Mac. Google seems to have a great answer for java web start option (https://blog.codecentric.de/en/2012/01/continuous-integration-for-ios-projects-with-jenkins-ci/), however can someone clarify steps for setting up jenkins slave on mac with ssh start option.

目前,詹金斯大师正在使用Centos.据我了解,要在Mac上做奴隶,您应该: 1.转到Mac,并使用代理本身将驻留的home文件夹为jenkins创建一个新的sudo用户. 2.在Jenkins Web界面中使用该用户的login | pass将节点设置为常用的linux节点. 3.将您的mac版本限制为该节点.

Currently jenkins master is on Centos. As I understood, to make a slave on Mac you should: 1. Go to Mac and create a new full-fledged sudo user for jenkins with home folder where agent itself will reside. 2. Set up node as ususal linux node in Jenkins web interface with login|pass for this user. 3. Restrict your mac build to this node.

但是,我不确定第一步是否正确-我是否需要手动设置具有增强权限的jenkins用户,具有登录计算机的能力等.也许可以创建隐藏"用户-如果那样是这样,有人可以为此提供帮助或指向好的手册吗?我是Mac终端机的新用户,所以不确定步骤是否与linux相同或不同.

However I'm not sure if first step is right - do i need to set up jenkins user by hand with elevated privileges, ability to log onto machine, etc. Perhaps it's possible to create a "hidden" user - if that is so, can someone help or point to good manual for this? I'm new to mac terminal, so not sure if steps all the same as linux or different.

谢谢.

推荐答案

刚刚完成了Mac mini从站的ssh访问设置.许多旧的教程以及包含不必要信息的教程.我必须重新启动mini才能重新开始,这一次它起作用了.

Just finished setting up my Mac mini slave for ssh access. Lots of old tutorials and ones with unnecessary information. I had to reboot my mini to start over again and this time it worked.

要快速说出来(全部通过终端/命令行,没有其他Ubuntu的话):

To put it quickly (this is all through terminal/command line, no Ubuntu nothing else):

  1. 使用ssh-keygen创建ssh私钥和公钥.在我的情况下,密钥是用-C "name"给我的,但没有密码短语,文件名是id_rsaid_rsa.pub.保留私用(非.pub)密钥供Jenkins凭证稍后使用,并用于测试目的,同时验证事物是否可用于ssh连接,而不必重新启动Jenkins代理,私钥应保留在/Users/<username>/.ssh目录中,并具有可读权限和本地测试主机用户的所有权(如果这就是我对其进行测试的方式)

  1. Create ssh private and public keys with ssh-keygen. In my case keys were given to me with -C "name" but no passphrase and with file names of id_rsa and id_rsa.pub. Keep private (non .pub) key to be used by Jenkins Credentials later and for testing purposes while verifying things are working for ssh connection without having to relaunch Jenkins agent, the private key should be kept in the /Users/<username>/.ssh directory and readable permission and ownership of the user of local test host if that's how I'm testing it

mkdir .ssh

确保.ssh目录以及所有子目录或文件的所有者是jenkins而不是root(sudo chown ...).

on Mac mini make sure owner of .ssh directory and any sub directories or files are jenkins and NOT root (sudo chown ...).

确保.ssh目录以及所有子目录或文件的权限是可读写的(如果您没有正确设置所有权,则为了更改权限,您将需要使用sudo.使用sudo设置权限,您尚未正确设置对jenkins用户的所有权)

make sure permissions of .ssh directory and any sub dirs or files are read and writeable (if you haven't set ownership properly, in order to change permissions you will be required to use sudo. If you are using sudo to set permissions, you haven't properly set ownership to the jenkins user)

在Mac mini系统偏好设置中允许远程登录->共享->选中远程登录",并允许管理员和静态IP->网络-> TCP/IP->使用手动或完全手动的DHCP

allow remote login in the Mac mini system preferences -> Sharing -> check Remote login and allow Administrators and static IP -> Network -> TCP/IP -> DHCP with manual or completely manual

键,以确保可以通过密码验证进入远程Mac mini.您可能会收到请求以确认新主机(位于远程Mac mini的IP地址).

on test host/local machine (non Mac mini) terminal and command line ssh jenkins@static.ip.address.of.MacMini to make sure you can ssh into remote Mac mini with password authentication. You may get a request to okay the new host (at remote Mac mini's IP address).

然后注销并在本地计算机中使用ssh-copy-id -iid_rsa.pub的内容(无论它在.ssh中还是任何地方)复制到找到的授权密钥

then logout and in local machine use ssh-copy-id -i to copy contents of id_rsa.pub (whether its in .ssh or wherever) to authorized_keys found here.

这将在.ssh目录中自动生成authorized_keys文件

this will automatically generate authorized_keys file in .ssh directory

确保authorized_keys文件也具有适当的权限

make sure authorized_keys file is also of proper permission

管理节点.创建一个新节点.添加凭据,并使用私钥将其设置为ssh用户名.用户名:jenkins.私钥:直接输入.应该从本地计算机测试主机私钥(pbcopy<~/.ssh/id_rsa)复制字符串,包括==== beginend private key ======部分,然后保存.

in Jenkins manage nodes. Create a new node. Add credential and make it ssh username with private key. Username: jenkins. Private key: enter directly. String should be copied from local machine test host private key (pbcopy<~/.ssh/id_rsa) including the ==== begin and end private key ====== parts and then save.

然后在新的节点配置上不需要工具包.远程根目录:/Users/jenkins.主机:Mac mini的静态IP地址.主机密钥验证策略:手动可信密钥验证策略.检查是否需要手动验证初始连接

Then on new node configuration No need for toolkit. Remote root directory: /Users/jenkins. Host: Mac mini's static IP address. Host Key verification strategy: Manually Trusted Key verification strategy. Check require manual verification of initial connection

如果您没有JDK设置并正在运行,则在首次尝试连接时进行操作.我下载了Java 8 Stack Exchange开发工具包,并确认将它安装在具有javac-version和java-version的Mac mini上后,我再次启动了代理程序,并且没有问题.

upon first connection attempt if you don't have JDK setup and running then do so. I downloaded Java 8 Stack Exchange Development Kit and once I confirmed it was installed on Mac mini with javac-version and java-version I launched agent again and authenticated no problem.

我在阅读旧教程时遇到的错误是:

My mistakes from reading old tutorials were:

试图消除/etc/ssh/sshd_config中对密码的需要.这是完全没有必要的 另外,我可能没有注意所有者和/或破坏了.ssh.ssh/authorized_keys& .ssh/id_rsa在远程计算机和我的本地计算机中.

trying to remove the need for passwords in /etc/ssh/sshd_config. This was completely unnecessary Also, I may have not paid attention to the owner and/or screwed up permissions of .ssh, .ssh/authorized_keys & .ssh/id_rsa in remote and my local machine as well.

最初,当我在詹金斯中创建证书时手动输入私钥时,我删除了===== Begin private key======End private key.这些应该包括在内. id_rsa文件应保留原样.

Initially I deleted the ===== Begin private key and ======End private key when I manually entered the private key when creating the credential in jenkins. Those should be included. The file of id_rsa should be left as is.

这篇关于在Mac OS上设置jenkins slave的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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