Jenkins - 如何建立一个特定的分支 [英] Jenkins - how to build a specific branch

查看:71
本文介绍了Jenkins - 如何建立一个特定的分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这并不像进行参数化构建那么简单.我已经有了一个特定的构建过程,只要将这些分支中的任何一个推送到 GitHub,就会构建和部署:

This isn't as simple as just doing a parametrized build. I've already got a specific build process that will build and deploy whenever any of these branches are pushed to GitHub:

所以如果我刚刚推送了 develop 并且它成功构建,我如何触发手动构建并让它拉取 feature/my-new-feature(没有做一个 git push)?我尝试启用参数化构建,添加一个名为 branch 的新字符串,然后添加一个新的分支说明符 */$branch.然后我运行了一个构建并将 branch 设置为 feature/my-new-feature 并且它仍然从 develop 中提取.

So if I've just pushed develop and it built successfully, how do I trigger a manual build and have it pull feature/my-new-feature (without doing a git push)? I tried enabling parametrized build, adding a new string called branch, and then adding a new branch specifier, */$branch. I then ran a build and set branch to feature/my-new-feature and it still pulled from develop.

非常感谢您的帮助!

推荐答案

最佳解决方案可以是:

在现有作业中添加字符串参数

Add a string parameter in the existing job

然后在 Source Code Management 部分更新 Branches to build 以使用您定义的字符串参数

Then in the Source Code Management section update Branches to build to use the string parameter you defined

如果您看到标记为 Lightweight checkout 的复选框,请确保未选中它.

If you see a checkbox labeled Lightweight checkout, make sure it is unchecked.

图像中指示的配置将告诉 jenkins 作业使用 master 作为默认分支,对于手动构建,它会要求您输入分支详细信息(仅供参考:默认情况下设置为 <代码>master)

The configuration indicated in the images will tell the jenkins job to use master as the default branch, and for manual builds it will ask you to enter branch details (FYI: by default it's set to master)

这篇关于Jenkins - 如何建立一个特定的分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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