[英]Get the 'create from' branch name from a tag push gitlab-ci
I would like to get the branch name when a tag push is done in my gitlab-ci worker.我想在我的 gitlab-ci 工作人员中完成标签推送时获取分支名称。
When a push is done, the CI_COMMIT_REF_NAME var contains the branch name.推送完成后,CI_COMMIT_REF_NAME 变量包含分支名称。 But for a tag push, it's replaced by the tag itself and I didn't find a way to get the branch name.
但是对于标签推送,它被标签本身所取代,我没有找到获取分支名称的方法。
By branch name, I refer to the 'create from' field filled, as you can see on the screenshot bellow.通过分支名称,我指的是填充的“创建自”字段,如下面的屏幕截图所示。 This field can refer to a branch that I would like to get in my gitlab-ci script.
该字段可以引用我想在我的 gitlab-ci 脚本中获取的分支。
I would like to get development
.我想得到
development
。
You can't.你不能。
A tag is (like a branch) a reference, a pointer to a commit .一个标签(就像一个分支)是一个引用,一个指向提交的指针。 You commit can be in multiple branches, and Gitlab won't be able to guess which one you would like to use.
您的提交可以在多个分支中,并且 Gitlab 将无法猜测您要使用哪一个。
Example:例子:
dc73e1c Foo
7e9e838 Bar * 1.0, master
956750e Baz
c938048 Qux
6dee84d Quux * develop
You push the 1.0
tag, which points on 7e9e838
.您推送
1.0
标签,它指向7e9e838
。 This commit is part of master
AND develop
.此提交是
master
AND develop
的一部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.