BraveWangDev 2020-06-10
<!--此案例两台服务器,100.10是Jenkins服务器,100.20是客户端--> <!--自行安装好Jenkins和下载好publish over ssh插件和Email Extension Plugin 插件--> [ ~]# ssh-keygen -t rsa <!--Jenkins服务器生成ssh密钥--> [ ~]# cat .ssh/id_rsa.pub >> .ssh/authorized_keys <!--将Jenkins自己的公钥输入到公钥配置文件中保存--> [ ~]# ssh-copy-id -i .ssh/id_rsa.pub <!--将Jenkins的ssh公钥拷贝到100.20服务器--> [ ~]# ssh <!--Jenkins服务器测试免密登录100.20-->
[ ~]# cat .ssh/id_rsa <!--查看私钥-->
[ ~]# cd /tmp/ <!--进入tmp目录--> [ tmp]# ls <!--查看是否自动创建accp目录--> accp akuma6688894331215680472jar hsperfdata_jenkins hsperfdata_root jetty-0_0_0_0-8080-war-_-any-1540444637075332110.dir jetty-0_0_0_0-8080-war-_-any-4925329859175627632.dir jna21252815367201186jar lua_SQXqZm systemd-private-9d09bb5b9f5b4ffd8c3a65fa0bb96fa5-chronyd.service-vFbZSP systemd-private-9d09bb5b9f5b4ffd8c3a65fa0bb96fa5-cups.service-AHVikS systemd-private-9d09bb5b9f5b4ffd8c3a65fa0bb96fa5-vgauthd.service-75jObR systemd-private-9d09bb5b9f5b4ffd8c3a65fa0bb96fa5-vmtoolsd.service-PBFEqQ tmp.W114IMXVc4 winstone1052959205009407779.jar winstone7677488302915714055.jar [ tmp]# cd accp/ <!--进入accp目录--> [ accp]# ls <!--查看pipework是否下载成功--> docker-compose.yml doctoc LICENSE pipework pipework.spec README.md
[ ~]# cd /tmp/ <!--进入tmp目录--> [ tmp]# ls <!--查看benet目录是否自动创建--> benet systemd-private-1f89507ba3a14cafaac65a447ec7b5a9-chronyd.service-4bmE7X systemd-private-1f89507ba3a14cafaac65a447ec7b5a9-cups.service-pe3QVn systemd-private-1f89507ba3a14cafaac65a447ec7b5a9-vgauthd.service-9K58TD systemd-private-1f89507ba3a14cafaac65a447ec7b5a9-vmtoolsd.service-GlsrXi [ tmp]# cd benet/ <!--进入benet目录--> [ benet]# ls <!--查看pipework是否下载成功--> docker-compose.yml doctoc LICENSE pipework pipework.spec README.md
此时任务构建成功或者是故障都不会发送邮件管理员也不会及时处理问题,接来配置异常告警,然后再配置成功告警
[ accp]# rm -rf ./* <!--删除下载好的pipework所有东西--> [ benet]# rm -rf ./* <!--删除下载好的pipework所有东西-->
[ tmp]# chattr +i accp/ <!-锁定accp目录--->
[ tmp]# cd accp/ <!--进入accp目录--> [ accp]# ls <!--查看是否下载,然而并没有数据-->
[ tmp]# chattr -i accp/ <!--解锁accp目录-->
[ accp]# ls <!--查看accp目录pipework是否下载--> docker-compose.yml doctoc LICENSE pipework pipework.spec README.md [ benet]# ls <!--查看benet目录pipework是否下载--> docker-compose.yml doctoc LICENSE pipework pipework.spec README.md
接下来配置任务构建成功也发送邮件通知
[ accp]# ls docker-compose.yml doctoc LICENSE pipework pipework.spec README.md [ benet]# ls docker-compose.yml doctoc LICENSE pipework pipework.spec README.md
[ accp]# rm -rf ./* <!--删除accp目录下所有数据-->
[ tmp]# chattr +i accp/ <!--锁定accp目录-->
[ accp]# ls <!--然而accp目录并没有数据--> [ accp]#
[ ~]# vim /var/lib/jenkins/users/admin_3482934551058146071/config.xml <!----> 34 <passwordHash>#jbcrypt:$2a$10$PerJswtfjaa6ukA1t0K/ueUK5CI3rjA1.XUx4wCQt88dhihfxObBW</pass wordHash> <!--定位到passwordHash将原来的加密密码删除更换成现在的,登录密码为abc-123-->
[ ~]# /etc/init.d/jenkins restart <!--重新启动Jenkins-->
———————— 本文至此结束,感谢阅读 ————————