Jenkins Git插件:git describe无法描述任何内容

时间:2012-04-22 14:11:10

标签: python git jenkins jenkins-plugins

我正在使用Jenkins的Git PluginDouglas Creager's get_git_version脚本。这使用git describe来获得python模块的一些合理版本。通常这会创建像0.1-11-g80fe130这样的东西,但是在jenkins上我得到了:

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

我已经将插件配置为不通过'skip internal tags'来提供自己的标签。

像在this question about pushing from jenkins中一样额外检查主分支也无济于事。

2 个答案:

答案 0 :(得分:2)

关于标签(如“Git Tip of the Week: Tags”中所述)

  

如果未找到带注释的标签,则会打印fatal: No names found, cannot describe anything   要允许describe使用非带注释的标记,请使用git describe --tags 运行   也可以使用git describe --all来对分支进行描述,但这只有在远程知道分支时才有意义。

因此有可能你当前的Git插件正在做一个简单的git描述的repo不包含任何带注释的标签(这解释了为什么检查分支的提示不能解决问题:这不是关于一个脱离头部的情况)

您需要克隆存储库,包括标记。


实际上,OP Jasper Van Den Bosch报告:

  

我没有正确地推动标签

没有标签被推送,意味着Jenkins在更新自己的克隆时没有获得这些标签,这意味着git describe无法正常工作。

答案 1 :(得分: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