将多个 git repos 签出到同一个 Jenkins 工作区 [英] Checkout multiple git repos into same Jenkins workspace

查看:29
本文介绍了将多个 git repos 签出到同一个 Jenkins 工作区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Jenkins 1.501 和 Jenkins Git 插件 1.1.26

Using Jenkins 1.501 and Jenkins Git plugin 1.1.26

我有 3 个不同的 git 仓库,每个仓库都有多个项目.

I have 3 different git repos each with multiple projects.

现在我需要将 3 个 git 存储库中的所有项目检出到 Jenkins 从站上的同一个工作区中.我在:源代码管理:多个 SCM 中定义了每个 git 存储库.但是每次检出一个 repo 时,前一个 repo(及其关联的项目)都会被删除.

Now I need to checkout all projects from the 3 git repos into the same workspace on a Jenkins slave. I have defined each git repo in: Source code Management: Multiple SCMs. But each time a repo is checked out the previous repo (and its associated projects) is deleted.

我读过这个:

http://jenkins.361315.n4.nabble.com/multiple-git-repos-in-one-job-td4633300.html

但它并没有真正的帮助.我试图在 Local 子目录下为所有存储库指定相同的文件夹(可选),但它给出了相同的结果.

but its does not really help. I have tried to specify the same folder under Local subdirectory for repo (optional) for all repos but it gives the same result.

如果使用 Jenkins 这根本不可能,我想可以使用一些预构建步骤/脚本将项目移动到正确的位置.它不是修改项目构建配置的选项.

If this is simply impossible using Jenkins I guess some pre-build step/scripting could be used to move the projects into the right location. Its not an option to modify the build configuration of the projects.

推荐答案

使用 Jenkins + Git 插件无法在单个工作区中一次检出多个存储库.

Checking out more than one repo at a time in a single workspace is not possible with Jenkins + Git Plugin.

作为一种变通方法,您可以有多个上游作业,每个检查一个存储库,然后复制到您的最终项目工作区(在多个级别上有问题),或者您可以设置一个 shell 脚本步骤来检查每个在构建时需要 repo 到作业工作区.

As a workaround, you can either have multiple upstream jobs which checkout a single repo each and then copy to your final project workspace (Problematic on a number of levels), or you can set up a shell scripting step which checks out each needed repo to the job workspace at build time.

以前多 SCM 插件可以帮助解决此问题,但现在已弃用.从多 SCM 插件页面:用户应该迁移到 https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin.Pipeline 提供了一种更好的方式来检查多个 SCM,并且得到 Jenkins 核心开发团队的支持."

Previously the Multiple SCM plugin could help with this issue but it is now deprecated. From the Multiple SCM plugin page: "Users should migrate to https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin . Pipeline offers a better way of checking out of multiple SCMs, and is supported by the Jenkins core development team."

这篇关于将多个 git repos 签出到同一个 Jenkins 工作区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆