docker-compose.yml 注意/var/jenkins_home 权限
version: '3'
services:
jenkins:
image: 'jenkins/jenkins:lts'
privileged: true
container_name: jenkins
restart: always
user: root
ports:
- '8080:8080'
- '50000:50000'
volumes:
- '/var/jenkins_home:/var/jenkins_home'
environment:
JAVA_OPTS: '-Dhudson.model.DownloadService.noSignatureCheck=true'
下载插件加速
Manage Jenkins -> Plguin Manage -> Advance(高级):
升级站点改为:
https://jenkins-update.davidz.cn/update-center.json
语法:
node('master') {
stage('git') {
git credentialsId: '5141bdf9-7359-40e1-886c-e8c4e6eb846a', url: 'http://192.168.0.102:10088/ls/devops.git'
}
stage('Build') {
echo "hello"
}
}
node('192.168.0.47') {
stage('git') {
git credentialsId: '5141bdf9-7359-40e1-886c-e8c4e6eb846a', url: 'http://192.168.0.102:10088/ls/devops.git'
}
stage('Build') {
echo "hello"
}
}
如果出现 “
/var/jenkins_home/workspace/pip@tmp/durable-fd307171/script.sh: 1: /var/jenkins_home/workspace/pip@tmp/durable-fd307171/script.sh: /var/jenkins_home/workspace/pip/run.sh: Permission denied
”
原因是脚本没有执行权限
语法:http://www.uml.org.cn/jchgj/201802051.asp
定时触发:https://www.jianshu.com/p/509c59391b3b
(yum 安装 jenkins)
yum install -y java-1.8.0-openjdk && \
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo && \
rpm --import https://pkg.jenkins.io/redhat/jenkins.io.key &&\
yum clean all && yum makecache && \
yum install -y jenkins && \
systemctl start jenkins