1、Linux 的 Slave机器设置
作为slave的Linux机器为centos系统.
ip: 129.204.207.127
环境:java1.8、maven、git、tomcat:8090
路径:
java : /usr/local/jdk1.8
maven : /usr/local/apache-maven-3.6.2
git : /usr/share/git-core
tomcat: /usr/local/apache-tomcat-8.5.46
环境变量:
export JAVA_HOME=/usr/local/jdk1.8
export PATH=PATH
export CLASSPATH=.:JAVA_HOME/lib/tools.jar
export MAVEN_HOME=/usr/local/apache-maven-3.6.2
export PATH=PATH
用户:root/123456
生成ssh:私钥、公钥 Linux生成SSH密钥方式
生成:authorized_keys 并授权
[root@VM_0_6_centos ~]# cd .ssh
[root@VM_0_6_centos .ssh]# ls
id_rsa id_rsa.pub known_hosts
[root@VM_0_6_centos .ssh]# cat id_rsa.pub > authorized_keys
[root@VM_0_6_centos .ssh]# ls
authorized_keys id_rsa id_rsa.pub known_hosts
[root@VM_0_6_centos .ssh]# chmod 700 authorized_keys
2、jenkins配置节点slave凭证
创建节点凭证:root/私钥 节点配置5.png3、jenkins创建节点slave
系统管理->节点管理->新建节点:
查看节点列表:显示节点磁盘大小说明配置成功 节点配置7.png节点凭证:'用户/私钥' 或者是 '用户/密码'。
用户/私钥:Manunlly trusted key Verification Strategy
用户/密码:Non verifying Verification Strategy
5、jenkins测试节点:
新建任务:任务名称:springboot-test-gitlab、选择:构建一个自由风格的软件项目
节点配置8.png节点配置9.png
执行立即构建
控制台输出:
成功控制台输出
Started by user zhengja
Running as SYSTEM
Building remotely on Linux_127 in workspace /root/.jenkins/workspace/springboot-test-gitlab
[springboot-test-gitlab] $ /bin/sh -xe /tmp/jenkins1901112003247678190.sh
+ ifconfig
docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
inet6 fe80::42:edff:fe35:28c8 prefixlen 64 scopeid 0x20<link>
ether 02:42:ed:35:28:c8 txqueuelen 0 (Ethernet)
RX packets 510 bytes 75763 (73.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 489 bytes 56366 (55.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
group default
link/ether c2:51:e9:ca:47:56 brd ff:ff:ff:ff:ff:ff link-netnsid 0
inet6 fe80::c051:e9ff:feca:4756/64 scope link
valid_lft forever preferred_lft forever
Finished: SUCCESS
节点配置测试成功!
网友评论