2012-04-22 179 views
2

我正在使用Jenkins的Git Plugin并使用Douglas Creager's get_git_version脚本。这使用git描述为python模块获取一些合理的版本。通常,这将创建类似0.1-11-g80fe130,但詹金斯我得到:Jenkins Git插件:git describe不能描述任何东西

+ git describe 
fatal: No names found, cannot describe anything. 

我已经配置插件不通过“跳过内部变量”拿出了自己的标签。

this question about pushing from jenkins这样的主分支进行额外检出并没有帮助。

回答

2

关于标签

如果没有找到注释标记,然后将打印fatal: No names found, cannot describe anything(如 “Git Tip of the Week: Tags” 中所述)。
要允许描述使用未注释的标签,请使用git describe --tags运行。
也可以使用git describe --all来描述分支,尽管这只有在远端已知分支时才有意义。

所以有可能您的当前回购对Git插件做一个简单的Git描述不包含任何带注释的标签(这解释了为什么一个分支的提示签出没有解决问题:这不是关于DETACHED HEAD的情况)

您需要克隆repo,包括标签。


其实,OP Jasper Van Den Bosch报道:

我没有推标签正确

无标记推,意味着要更新自己的克隆时,詹金斯没有得到这些标签,表示git describe无法正常工作。

+0

但我怎么能得到jenkins结帐从原产地/主人获取标签? – 2012-04-22 14:23:05

+1

@JaspervandenBosch不知道当前插件是否支持这个功能,除非您在Jenkins Jobs的第一步中定义了一个额外的命令来从远程仓库导入标签(至少一个'git fetch --tags',combined使用git checkout master,以确保已经导入了所有标签,并且位于分支的顶端)。 – VonC 2012-04-22 14:26:01

+0

'+ git checkout master 切换到分支'主' + git fetch --tags'没有做 – 2012-04-22 14:36:48

0

git describe只有在当前检出之前的历史记录中有一个标签(最好是带注释的标签)后才能正常工作。

/tmp/repo$ git describe 
fatal: No names found, cannot describe anything. 
/tmp/repo$ git tag foo 
/tmp/repo$ git describe 
fatal: No annotated tags can describe '14d827c72b2f277a5cd3e65e7b0e0502edc58fa3'. 
However, there were unannotated tags: try --tags. 
/tmp/repo$ git tag -a 'annotated-tag' -m 'whatever' 
/tmp/repo$ git describe 
annotated-tag 
+0

谢谢。 github托管的存储库(origin/master)被标记。所以,如果我克隆它在任何计算机上我有标签,但不在詹金斯 – 2012-04-22 14:21:00