我正在尝试在Bamboo版本中标记 ruby gem 的git repo。我认为在 ruby 中做这样的事情会做的

`git tag v#{current_version}`
`git push --tags`

但是问题是仓库没有来源。竹以某种方式摆脱了origin有什么线索吗?

最佳答案

是的,如果导航到作业工作区,您会发现Bamboo不会在“幕后”进行直接的git clone,并且将远程设置为内部文件路径。

幸运的是,Bamboo确实将原始存储库URL存储为$ {bamboo.repository.git.repositoryUrl},因此您需要做的就是设置一个指向原始对象的远程指针并推送到该原始对象。这就是我一直在基本Git存储库和Stash中使用的东西,它基于内部版本号创建标签。

git tag -f -a ${bamboo.buildNumber} -m "${bamboo.planName} build number ${bamboo.buildNumber} passed automated acceptance testing." ${bamboo.planRepository.revision}
git remote add central ${bamboo.planRepository.repositoryUrl}
git push central ${bamboo.buildNumber}
git ls-remote --exit-code --tags central ${bamboo.buildNumber}

最后一行只是在无法回读新创建的标记时导致任务失败。

编辑:不要试图使用变量$ {bamboo.repository.git.repositoryUrl},因为这不一定指向您工作中 checkout 的仓库。

还要记住,如果要从多个来源 checkout ,则$ {bamboo.planRepository.repositoryUrl}指向“源代码 checkout ”任务中的第一个存储库。通过以下方式引用更具体的URL:
${bamboo.planRepository.1.repositoryUrl}
${bamboo.planRepository.2.repositoryUrl}
...

等等。

关于bamboo - 如何在 Bamboo 制建筑中标记git repo,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27371629/

10-11 17:17