jenkins-pipeline - Jenkins 管道 : How to checkout repository without triggering polling or tracking changes?

标签 jenkins-pipeline

我的项目由多个 git 存储库组成。一个主存储库和其他辅助存储库。在 jenkins 管道中,我想对所有这些进行 checkout scm:,但我只对跟踪更改和从主存储库进行轮询感兴趣 - 其他人会弄乱更改日志并导致其他基础设施问题(这是一个大项目)。

我想简单地检查 sh 块中的剩余存储库以跳过我不想要的“功能”,但我必须复制配置,并以某种方式传递凭据 - 通常我希望管道为我完成工作。

预期结果:checkout scm 不会导致更改日志出现,也不会导致从所述存储库向下进行轮询。

有没有办法使用配置来归档它,而不是使用 sh 步骤隐藏管道中的结账逻辑?

最佳答案

当您 checkout 其他存储库时,您可以使用类的可选参数禁用更改日志和轮询。例如,给定一个名为 helper 的辅助存储库:

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

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

查看 GitSCM 管道步骤 documentation 了解更多信息。

关于jenkins-pipeline - Jenkins 管道 : How to checkout repository without triggering polling or tracking changes?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55634438/

相关文章:

Jenkins Pipeline 每个分支的环境变量配置

jenkins - 是否可以在循环中创建并行的 Jenkins 声明式流水线阶段?

jenkins - 有没有办法模拟 Jenkins 管道作业的读写锁?

Jenkins 不会保存全局工具配置

docker - 带有 docker 代理的 Jenkinsfile 无法加载 ssh key

jenkins-pipeline - 使用 Groovy 脚本的 Jenkins Active Choice 参数调用函数

docker - Jenkinsfile 中的 "withRun"和 "inside"有什么区别?

Jenkins : How can I make a build fail if another job is unsuccessful?

来自并行作业的 Jenkins Artifact

jenkins - 在不同节点上运行 Jenkins stage