Jenkins Job无法生成合并请求

发布于 2025-01-19 23:05:29 字数 357 浏览 6 评论 0原文

我们的团队正在开发一个 Jenkins 作业,当我们将开发分支合并到存储库中的发布分支时,我们可以使用它创建合并/拉取请求。此作业将同时为 32 个存储库执行此任务,因为所有存储库都具有相同的分支名称。版本控制是gitlab。

现在,我在 Jenkins Build Step > 中使用以下命令:执行 Shell 创建合并请求。

git push  -v --push-option='merge_request.create' origin ${SourceBranch}:${TargetBranch}

现在不再创建合并请求,而是直接合并两个分支。

请帮我解决这个问题。

提前致谢。

Our team is developing a Jenkins job using which we can create Merge/Pull request when we are merge dev branch to release branch in our repo. This job will do this task for 32 repos at once as all repos have same branch names. Version control is gitlab.

Now, I am using following command in Jenkins Build Step > Execute Shell to create merge request.

git push  -v --push-option='merge_request.create' origin ${SourceBranch}:${TargetBranch}

Now Instead of creating Merge request, it is directly merging the two branches.

Please help me to solve this problem.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别靠近我心 2025-01-26 23:05:29

Origin $ {sourceBranch}:$ {targetBranch}

这会将您的源分支推向远程目标分支,这不是您想要的。

要获取所需的行为(创建从源到目标的MR)推到源分支并使用merge_request.target选项,以指定MR的目标分支。

git push  -v \
    -o merge_request.create \
    -o merge_request.target="${TargetBranch}" \
    origin "${SourceBranch}"

这将推向源分支,并创建从源分支到目标分支的MR。

origin ${SourceBranch}:${TargetBranch}

This will push your source branch to the remote target branch, which is not what you want.

To get the behavior you want (creating an MR from source to target) push to the source branch and use the merge_request.target option to specify the target branch for the MR.

git push  -v \
    -o merge_request.create \
    -o merge_request.target="${TargetBranch}" \
    origin "${SourceBranch}"

This will push to the source branch and create an MR from the source branch to the target branch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文