Jenkins Gitee 自动部署()
2022-04-10 本文已影响0人
Butif_D
Jenkins 配置文件地址
centos: /etc/sysconfig/jenkins
ubuntu: /etc/default/jenkins
修改配置文件 检查jenkins配置配置文件,将执行用户改成root,不然后面可能出现执行shell没有权限
修改用户组: chown -R root:root jenkins
修改站点 未尝试
![](https://img.haomeiwen.com/i12980770/cfcef44423316afb.png)
插件:
Maven Integration
gitee
修改系统配置:
![](https://img.haomeiwen.com/i12980770/5017e7a3a720a099.png)
修改全局配置:
![](https://img.haomeiwen.com/i12980770/c291554dd2e8b0ed.png)
![](https://img.haomeiwen.com/i12980770/32d1f1af829c18bd.png)
![](https://img.haomeiwen.com/i12980770/f7afa769e1011271.png)
准备开始:
新建任务
![](https://img.haomeiwen.com/i12980770/9dce02b8c82b9de8.png)
![](https://img.haomeiwen.com/i12980770/b4e5670d7263522a.png)
![](https://img.haomeiwen.com/i12980770/11ee537e596ba1e1.png)
![](https://img.haomeiwen.com/i12980770/ab47cd16169ff072.png)
![](https://img.haomeiwen.com/i12980770/d933be62669155ab.png)
前往gitee配置WebHook [马赛克就是域名]
![](https://img.haomeiwen.com/i12980770/06d9cced9c8cedb6.png)
http://[Jenkins用户名]:[Jenkins用户密码]@http://[Jenkins公网地址]:[Jenkins公网端口]/generic-webhook-trigger/invoke
注: 使用内网穿透搭建一个可以通过公网访问的Jenkins
花生壳官网
![](https://img.haomeiwen.com/i12980770/e6462e5850087fa9.png)
![](https://img.haomeiwen.com/i12980770/c33de97966025679.png)
![](https://img.haomeiwen.com/i12980770/c56fee04e29feb6b.png)
## stop.sh
#!/bin/bash
echo "Stop Procedure : demo-1.0-SNAPSHOT.jar"
pid=`ps -ef |grep java|grep demo.jar|awk '{print $2}'`
echo 'old Procedure pid:'$pid
if [ -n "$pid" ]
then
kill -9 $pid
fi
# start.sh
#!/bin/bash
echo 'Start the program : demo-1.0-SNAPSHOT.jar'
chmod 777 /home/dxy/app/demo.jar
echo '-------Starting-------'
cd /home/dxy/app/
nohup java -jar demo.jar &
echo 'start success'