war包方式
yum install dejavu-sans-fonts fontconfig xorg-x11-server-Xvfb -y
wget -c https://mirrors.ustc.edu.cn/jenkins/war-stable/2.346.2/jenkins.war
nohup /usr/local/jdk/bin/java \
-DJENKINS_HOME=/var/jenkins_home \
-Djenkins.model.Jenkins.slaveAgentPort=50000 \
-Duser.timezone=GMT+8 \
-jar /usr/local/jenkins.war --httpPort=8080 >/usr/local/jenkinsnohup.out 2 >&1 &
浏览器登录Jenkins
http://192.168.1.150:8080/
注:登录时需要输入密码,密码使用以下命令生成
[root@5f2352856ffc ~]# cat /var/lib/jenkins/secrets/initialAdminPassword
880628d83d754fe6a9937b3589a8a836
Jenkens升级
更新jenkins.war包即可,其他目录不要更改
改jenkins时间
在脚本命令行中执行
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'Asia/Shanghai')
设置中文
安装中文简体插件 然后设置 Local -> Default Language : zh_CN
插件代理地址
https://mirrors.huaweicloud.com/jenkins/updates/update-center.json
gitlab webhook 自动构建
jenkins
构建触发器 -> Build when a change is pushed to GitLab. GitLab webhook URL: http://192.168.0.122:64088/project/test2
高级 -token -> Generate生成一个token
gitlab
1、Admin Area - settings -> outbound requests ->expand
勾选(Allow requests to the local network from hooks and services)
2、进入项目 ->settings -> Integrations : 输入:
url :jenkins(GitLab webhook URL): http://192.168.0.122:64088/project/test2
token:
pushed
点击 add webhook
注:
1、当初始化插件慢或者打不开时或jenkins离线时,
可以访问http://x.x.x.x:8080/pluginManager/advanced,在最下面的地址栏中将https改为http
2、插件代理
升级站点 https://mirrors.huaweicloud.com/jenkins/updates/update-center.json
常见插件
multijob
build user vars
Describe With Params
gitlab
Git Parameter
......
------------------end