使用指定存储库中的 Git 分支动态填充 Jenkins 选择参数 [英] Dynamically Fill Jenkins Choice Parameter With Git Branches In a Specified Repo

查看:28
本文介绍了使用指定存储库中的 Git 分支动态填充 Jenkins 选择参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个参数化的 Jenkins 作业,它需要在特定的 Git 存储库中输入特定的 Git 分支.目前这个参数是一个字符串参数.

I have a parameterized Jenkins job which requires the input of a specific Git branch in a specific Git repo. Currently this parameter is a string parameter.

有什么办法可以让这个参数成为选择参数并用Git分支动态填充下拉列表?我不想要求有人在每次创建新分支时手动配置下拉菜单来维护这个选择参数.

Is there any way to make this parameter a choice parameter and dynamically fill the drop down list with the Git branches? I don't want to require someone to maintain this choice parameter by manually configuring the drop down every time a new branch is created.

推荐答案

扩展选择参数插件 将允许您从文件中读取选择.

Extended Choice Parameter plugin will allow you to read the choices from a file.

当然,现在你还有另一个问题:如何确保文件是最新的(可以通过 post-commit hook 完成)并传播给所有用户(可以通过放置它来完成)在共享文件服务器上).但可能有更好的解决方案.

Of course, now you have another problem: how to make sure the file is up-to-date (that can be done with a post-commit hook) and propagated to all the users (that can be done by placing it on a shared file server). But there may be better solutions.

这篇关于使用指定存储库中的 Git 分支动态填充 Jenkins 选择参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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