繁体   English   中英

Jenkins 触发 webhook 时获取错误的分支

[英]Jenkins fetching wrong branch when webhook triggers

当 gitlab feature-0提交并触发 jenkins webhook 时,jenkins 从 Main 分支而不是feature-0分支拉取。 反之亦然,如果main分支有提交,jenkins 有时会从feature-0分支获取。 我如何确保它在 webhook 触发时获取正确的分支?

Fetching changes from the remote Git repository
skipping resolution of commit remotes/origin/feature-0, since it originates from another repository
Multiple candidate revisions
Checking out Revision 1cda3cd8cb747c8588daaf07715499ea37927d8b (origin/main)
Commit message: "Please retry a full pipeline [ci build]"

上面的提交消息来自main分支。 feature-0分支有不同的提交消息,它触发了 jenkins 作业。

我在分支部分指定了 main 和 feature。 但它没有按预期工作。

在此处输入图像描述

解决了它:

我必须在 Jenkins 中将分支名称更改为${gitlabSourceBranch}并且在管道中运行 git 结帐时也删除branch名称。 然后它开始检查触发 webhook 的源分支。

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM