我可以让 Jenkins 从传入的参数中构建 git 标签吗?

问题描述:

Jenkins 支持参数化构建.

Jenkins supports parametrized builds.

我有一个部署版本,需要通过参数指定要部署的标签.(将特定标签部署到生产环境)

I have a deployment build that requires the tag to deploy to be specified via a parameter. (to deploy a particular tag to production)

使用 git 插件有没有一种简单的方法可以做到这一点?

Is there an easy way to do this with the git plugin?

我尝试添加参数 TAG_NAME,然后将作业的 git 插件部分中的 branch_specifier 设置为 $TAG_NAME.行不通.我得到:

I tried adding a parameter TAG_NAME, and then setting branch_specifier in the git plugin section of the job to $TAG_NAME. Dosen't work. I get:

ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.

有什么想法吗?

使构建参数化并在 git URL 框中,输入您定义的变量的名称.例如:${GIT_URL}.应该这样做.

Make the build parameterized and in the git URL box, put the name of the variable you've defined. For example: ${GIT_URL}. This should do it.