我有一个 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
这是我安装的插件:
默认行为已更改。它不再获取标签(使用 --no-tags)。
我找不到任何设置来强制 jenkins 获取标签。
在 Bitbucket 团队/项目设置中,您可以设置“高级克隆行为”:
未选择“不提取标签”。所以我认为它应该默认获取标签......
有人有类似的问题吗?
如何强制 Jenkins 在 Bitbucket 团队/项目作业中获取标签?
最佳答案
我创建了一个 Jenkins 问题并得到了一些解释(感谢 Stephen Connolly):https://issues.jenkins-ci.org/browse/JENKINS-46736
解决方案只是添加“高级克隆行为”并取消选中“不获取标签”。
关于Jenkins Bitbucket 团队/项目工作不再获取标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45996719/