我正在使用Jenkins Multiple SCM插件在我的Jenkins作业中将三个git存储库检入三个子目录.然后,我执行一组命令来构建一组工件,其中包含从所有三个存储库中提取的信息和代码.
现在折旧了多个SCM,文本建议移动到管道.我试过了,但我无法弄清楚如何让它发挥作用.
这是我有兴趣从Jenkins作业目录的顶层看到的目录结构:
$ ls
Combination
CombinationBuilder
CombinationResults
这三个子目录中的每一个都签出了一个git repo.使用多个SCM,我使用git,然后添加"checkout to a subdirectory"行为.这是我尝试使用管道脚本:
node('ATLAS && Linux') {
    sh('[ -e CalibrationResults ] || mkdir CalibrationResults')
    sh('cd CalibrationResults')
    git url: 'https://github.com/AtlasBID/CalibrationResults.git'
    sh('cd ..')
    sh('[ -e Combination ] || mkdir Combination')
    sh('cd Combination')
    git url: 'https://github.com/AtlasBID/Combination.git'
    sh('cd ..')
    sh('[ -e CombinationBuilder ] || mkdir CombinationBuilder')
    sh('cd CombinationBuilder')
    git url: 'https://github.com/AtlasBID/CombinationBuilder.git'
    sh 'cd ..'
    sh('ls')
    sh('. CombinationBuilder/build.sh')
}
但是,git命令似乎在工作区的顶级目录中执行(这有一定意义),并且根据语法,似乎没有checkout-to-sub-directory行为.
我正在使用Jenkins管道插件和Jenkinsfile.
在一个名为vms.git的存储库中,我有Jenkinsfile和它构建的应用程序.
我有另一个名为deploy.git的存储库,它包含我想用来在vms.git中部署应用程序的脚本.
目前我的Jenkinsfile看起来像这样
node {
  stage 'build'
  checkout scm
我在作业配置中定义了vms.git repo.
所以我想要检查两个存储库,然后使用vms.git中的Jenkinsfile来定义构建的其余部分.我想在其他管道中重用deploy.git脚本,所以我不想在其中放置Jenkins文件.