如何编写一个定义5个存储库的jenkins文件,不同的repo需要做不同的构建工作
每个Repo构建使用一个阶段。您可以使用"签出"签出不同的回购。
示例:
pipeline {
agent any
stages {
stage('Repo 1') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[url: 'YourRepo1']]])
echo "Build Repo1"
}
}
stage('Repo 2') {
steps {
checkout([$class: 'GitSCM',
branches: [[name: '*/master']],
doGenerateSubmoduleConfigurations: false,
extensions: [],
submoduleCfg: [],
userRemoteConfigs: [[url: 'YourRepo2']]])
echo "Build Repo2"
}
...
}
}
}
对于一个更干净的解决方案,你需要在内置中添加一些正在检查路由的路径。