Ben*_*Ben 74 git git-submodules jenkins
我在Jenkins的一个项目中有一个子模块.我已启用高级设置以递归更新子模块.
当我运行构建时,我看到工作区有子模块中的文件.问题是,它似乎是子模块的第一次修订.当我推送更改(在GitHub上托管的存储库)时,Jenkins似乎不更新子模块以获得正确的更改.有没有人见过这个?
Von*_*onC 83
请注意,Jenkins Git插件2.0将具有"提前子模块行为",这应该确保子模块的正确更新:
Advanced sub-modules behavior>"Path of the reference repo to use during submodule update"对这个字段,添加子模块git url.
对于身份验证问题,现在有一个"使用来自父存储库的默认远程的凭据"选项
sti*_*sti 27
您是否知道您的Git存储库总是引用子模块的特定修订版?Jenkins不会自动更改修订版.
如果要使用子模块的较新版本,则必须在本地Git存储库中执行此操作:
cd submoduledir
git pull
cd ..
git add submoduledir
git commit -m 'Updated to latest revision of submoduledir'
git push # Go and watch Jenkins build with the new revision of the submodule
Run Code Online (Sandbox Code Playgroud)
当你这样做时,Jenkins将在构建期间检查子模块的完全相同的修订版本.Jenkins自己决定使用哪个子模块修订版.这是Git子模块和SVN外部组件之间的根本区别.
您可能希望阅读有关子模块的良好参考,例如http://progit.org/book/ch6-6.html.
pot*_*nch 17
最后偶然发现了这样做的方法,这很简单.
使用凭据的初始克隆工作正常但后续submodule克隆失败并且凭据不正确.
Source Code Management >> Additional Behaviours >> Advanced sub-modules behaviours::导致凭证错误.git submodule update --init在该Execute Shell部分也失败,凭据错误.我正在使用jenkins-1.574.
Build Environment >> SSH Agent复选框. Source Code Management部分中选择的相同)更新该Execute Shell部分中的子模块
git submodule sync
git submodule update --init --recursive
Run Code Online (Sandbox Code Playgroud)这是一个截屏
看起来我找到了一个解决方案:
我添加了一个构建步骤来执行以下shell命令:
git submodule foreach git checkout master
git submodule foreach git pull
Run Code Online (Sandbox Code Playgroud)
小智 6
我正在使用带有结账插件的脚本化管道。如果您希望子模块与存储库中的子模块相同,只需关闭trackingSubmodules选项,如下所示:
checkout([$class: 'GitSCM', branches: [[name: '*/develop']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, recursiveSubmodules: false, reference: '', trackingSubmodules: false]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '[myCredentials]', url: 'https://git.myRepo.git']]])
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
64291 次 |
| 最近记录: |