【发布时间】:2017-09-01 09:03:52
【问题描述】:
我有一份 Jenkins Bitbucket 团队/项目工作。 在我的存储库中的 Jenkinsfile 中,我使用“git describe”来获取当前标签。 在我更新到最新的 Jenkins 版本(2.60.3)并更新了大多数插件后,这会失败,因为 Jenkins 不再获取标签。
这是我更新前的:
Branch event
Checking out git https://bitbucket.org/xxxxxxx to read Jenkinsfile
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://bitbucket.org/xxxxx.git # timeout=10
Fetching upstream changes from https://bitbucket.org/xxxx.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials Admin user to clone bitbucket repositories
> git fetch --tags --progress https://bitbucket.org/xxxxx.git +refs/heads/master
这就是我现在拥有的:
Branch event
Checking out git https://bitbucket.org/xxxx.git into /var/lib/jenkins/jobs/xxxx/jobs/xxx/branches/master/workspace@script to read Jenkinsfile
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository https://bitbucket.org/xxxxx.git
> git init /var/lib/jenkins/jobs/xxx/jobs/xxxx/branches/master/workspace@script # timeout=10
Fetching upstream changes from https://bitbucket.org/xxx.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials Admin user to clone bitbucket repositories
> git fetch --no-tags --progress https://bitbucket.org/xxxx.git +refs/heads/master:refs/remotes/origin/master
这是我安装的插件:
- Bitbucket 分支源插件 2.2.3
- Bitbucket 插件 1.1.5
- Git 客户端插件 2.5.0
- Git 插件 3.5.1
默认行为已更改。它不再获取标签(使用--no-tags)。 我找不到任何强制詹金斯获取标签的设置。 在 Bitbucket Team/Project 设置中,您可以设置“高级克隆行为”:
- 浅克隆
- ...
- 不获取标签
未选择“不获取标签”。所以我认为它应该默认获取标签......
有人遇到类似问题吗? 如何强制 Jenkins 在 Bitbucket 团队/项目作业中获取标签?
【问题讨论】:
-
对我来说同样的问题!
-
我看到您报告了 Bitbucket 插件中的一个错误:issues.jenkins-ci.org/browse/…。你有解决方法吗?由于我们使用的是 jgitver 插件,因此我的项目必须获取标签。我不得不回滚到以前版本的插件。
-
我现在使用的解决方法是在我的工作中手动获取标签...我在 Jenkinsfile 的第一步中运行
sh 'git fetch --tags'。但这有点难看,我无法初始化依赖于环境部分中标签的变量(在声明模式下)...... -
嗨@BenjaminBertrand,看起来你有同样的想法。但我遇到了以下问题:
+ git fetch --tags. fatal: could not read Username for 'https://bitbucket.org': No such device or address。您是如何解决凭据/身份验证问题的?
标签: jenkins