| 顶层 | agent 作用于整个流水线 |
|---|---|
| 阶段级 | 按阶段切换环境与标签 |
| none | 无默认节点,逐段声明 |
| 工作区 | 不同节点的工作目录彼此独立 |
分段调度
分段调度
pipeline {
agent none
stages {
stage('build') {
agent { label 'linux' }
steps { sh 'make build' }
}
stage('deploy') {
agent { label 'deploy' }
steps { sh './deploy.sh' }
}
}
}把构建与部署拆到不同标签节点:部署节点只保留发布所需凭据与网络权限。