我想使用两个 Git 存储库构建一个项目。其中一个包含源代码,而另一个包含构建和部署脚本。
我正在使用 Jenkins 管道来构建我的项目。管道脚本位于Jenkins-pipeline存储库中,源代码位于中间件存储库中。由于我的管道脚本位于 Jenkins-pipeline 存储库中,我正在使用 Jenkins-pipeline 存储库中的 Jenkinsfile 配置我的管道。
这是我正在使用的 Jenkins 文件:
pipeline {
agent any
parameters {
string(name: 'repo_branch', defaultValue: 'development', description: 'The branch to be checked out')
string(name: 'git_repo', defaultValue: 'ssh://git@my-server.com/middleware.git' description: 'Git repository from where we are going to checkout the code')
}
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
disableConcurrentBuilds()
timeout(time: 10, unit: 'MINUTES')
}
triggers {
pollSCM('* * * * *')
}
stages {
stage('Checkout git repo') {
steps {
git …Run Code Online (Sandbox Code Playgroud)