Jenkins管道:如何在不触发轮询或跟踪更改的情况下签出存储库? [英] Jenkins pipeline: How to checkout repository without triggering polling or tracking changes?

查看:57
本文介绍了Jenkins管道:如何在不触发轮询或跟踪更改的情况下签出存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目由多个git存储库组成.一个主存储库,其他辅助存储库.在jenkins管道中,我要全部 checkout scm:,但我只想跟踪更改并从主存储库中进行轮询-其他人会使更改日志混乱并导致其他基础结构问题(这是一个很大的问题项目).

My project consists of multiple git repositories. One main repository, and other helper repositories. In jenkins pipeline, I want to checkout scm: all of them, but I am only interested in tracking changes, and polling from the main repository - others clutter the changelog and cause other infrastructure problems (it's a big project).

我考虑过只检查 sh 块中的剩余存储库以跳过不需要的功能",但是我必须重复配置,并以某种方式传递凭据-通常我会就像管道为我完成工作.

I thought about simply checking out remaining repositories in sh blocks to skip "features" I don't want, but I'll have to duplicate config, and somehow pass credentials - generally I'd like pipelines to do the work for me.

预期结果: checkout scm 不会导致更改日志的出现,也不会导致从该存储库开始进行轮询.

Expected result: checkout scm does not cause changelog to appear, or cause polling from said repo down the line.

有没有一种方法可以使用配置来对此进行归档,而不是使用 sh step从管道中隐藏签出逻辑?

Is there a way to archive this using configuration, instead of hiding checkout logic from pipeline using shstep?

推荐答案

签出其他存储库时,可以禁用更改日志并使用该类的可选参数进行轮询.例如,给定一个名为 helper :

When you checkout the other repositories, you can disable the changelog and polling with the optional arguments to the class. For example, given a helper repository called helper:

checkout([$class: 'GitSCM',
          branches: [[name: '*/master']],
          userRemoteConfigs: [[url: 'http://git-server/user/helper.git']]
          changelog: false,
          poll: false
])

,然后将禁用 helper 存储库的更改日志和轮询.您可以为所有其他帮助程序存储库复制此用法,以禁用其更改日志和轮询.

and then the changelog and polling will be disabled for the helper repository. You can duplicate this usage for all your other helper repositories to disable their changelog and polling.

查看GitSCM管道步骤文档以获取更多信息.

Check the GitSCM Pipeline Step documentation for more information.

这篇关于Jenkins管道:如何在不触发轮询或跟踪更改的情况下签出存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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