我有 gitlab 仓库,在一个仓库下我有很多项目。现在我想将 gitlab 与 Jenkins 集成
I have gitlab repository, under one repository I have many projects. Now I want to intergrate gitlab with Jenkins
我有gitlab 仓库,在一个仓库下我有很多项目。现在我想将 gitlab 与 Jenkins 整合。因此,只要在 git 存储库中发生提交,存储库中的解决方案文件就应该构建。
但就我而言,如果我与 Jenkins 集成,我在同一 repository.so 中有许多解决方案文件,我只想触发与提交文件相关的解决方案文件。
他们是否通过使用 webhook(或任何方式)以任何方式知道存储库的哪个文件夹被修改了?这样我就可以根据路径
运行 相关的解决方案文件
文件夹结构:
Project1/project1.sln 和依赖文件
Project2/project2.sln 和依赖文件
感谢 advance.and 还请指导 githab webhook 配置以与 Jenkins 集成。
GitLab Webhooks can be created in the GitLab Web-Interface. The modified files are listed in the body of the Push-Message.
使用 Git 插件的解决方案
- 为一个解决方案文件创建一个自由式作业,例如
Project1
- 转到
Build Trigges
- Select
Poll SCM
.
- 将
Schedule
留空
- 转到
Source-Code-Management
- Select
Git
- 配置存储库URL 和凭据
- 输入分支,例如
refs/heads/master
- Select 存储库浏览器
(AUTO)
- 在其他行为处按
Add
底部的按钮
- Select
Polling ignores commits in certain Paths
- 用项目文件夹的路径填写
Included Regions
,例如^Project1/*.
。这意味着它只会在检测到该文件夹或其子文件夹中的更改时触发构建。
- 转到作业配置底部的
Post-Build Actions
并按 Add
按钮
- Select
Clean Workspace after Build
- 添加
Patterns for files to be deleted
按Add
按钮
- Select
Exclude
- 输入
**/.git/*
- Select 复选框
Apply pattern also on directories
当GitLab 发送推送消息时,Jenkins 将触发SCM 轮询此作业。它将验证相关文件夹中是否有更改。如果是这种情况,构建将开始。
您可以在 /job//scmPollLog/
查看 git 轮询协议
使用 GitLab 插件的解决方案
Jenkins GitLab Plugin 也是一个解决方案。
我有gitlab 仓库,在一个仓库下我有很多项目。现在我想将 gitlab 与 Jenkins 整合。因此,只要在 git 存储库中发生提交,存储库中的解决方案文件就应该构建。 但就我而言,如果我与 Jenkins 集成,我在同一 repository.so 中有许多解决方案文件,我只想触发与提交文件相关的解决方案文件。
他们是否通过使用 webhook(或任何方式)以任何方式知道存储库的哪个文件夹被修改了?这样我就可以根据路径
运行 相关的解决方案文件文件夹结构: Project1/project1.sln 和依赖文件 Project2/project2.sln 和依赖文件
感谢 advance.and 还请指导 githab webhook 配置以与 Jenkins 集成。
GitLab Webhooks can be created in the GitLab Web-Interface. The modified files are listed in the body of the Push-Message.
使用 Git 插件的解决方案
- 为一个解决方案文件创建一个自由式作业,例如
Project1
- 转到
Build Trigges
- Select
Poll SCM
. - 将
Schedule
留空 - 转到
Source-Code-Management
- Select
Git
- 配置存储库URL 和凭据
- 输入分支,例如
refs/heads/master
- Select 存储库浏览器
(AUTO)
- 在其他行为处按
Add
底部的按钮 - Select
Polling ignores commits in certain Paths
- 用项目文件夹的路径填写
Included Regions
,例如^Project1/*.
。这意味着它只会在检测到该文件夹或其子文件夹中的更改时触发构建。 - 转到作业配置底部的
Post-Build Actions
并按Add
按钮 - Select
Clean Workspace after Build
- 添加
Patterns for files to be deleted
按Add
按钮 - Select
Exclude
- 输入
**/.git/*
- Select 复选框
Apply pattern also on directories
当GitLab 发送推送消息时,Jenkins 将触发SCM 轮询此作业。它将验证相关文件夹中是否有更改。如果是这种情况,构建将开始。
您可以在 /job//scmPollLog/
查看 git 轮询协议使用 GitLab 插件的解决方案
Jenkins GitLab Plugin 也是一个解决方案。