6.Jenkins主从搭建以及使用
目的
完成Jenkins主从搭建,并且通过自由风格、pipeline、node方式的应用Demo
Jenkins主从搭建
代理
Manage Jenkins->Configure Global Security
新建Jenkins节点
Manage Jenkins->Manage Nodes and Clouds->新建节点
部署Agent.jar
执行命令后效果
从节点测试
Freestyle project
pipeline-pipeline
pipeline {
agent {
//指定从节点
label "slave"
}
stages {
stage('Hello') {
steps {
checkout([$class: 'GitSCM', branches: [[name: '*/master2']], extensions: [], userRemoteConfigs: [[credentialsId: '538da12e-f04b-41f2-adc3-7e1728a5bd1e', url: 'https://gitee.com/RollBack2010/jekins-study.git']]])
}
}
}
}
pipeline-node
node("slave") {
stage('Preparation') { // for display purposes
checkout([$class: 'GitSCM', branches: [[name: '*/master2']], extensions: [], userRemoteConfigs: [[credentialsId: '538da12e-f04b-41f2-adc3-7e1728a5bd1e', url: 'https://gitee.com/RollBack2010/jekins-study.git']]])
}
}