【问题标题】:Chef - Clone a specific tag from GitLabChef - 从 GitLab 克隆特定标签
【发布时间】:2016-05-17 18:27:51
【问题描述】:

我有这个 sn-p,我应该从 git 克隆一个 repo:

git "somerepo" do
  action :sync
  destination "/var/"
  repository "http://#{node["somerepo"][:git_user]}:#{node["somerepo"][:git_pass]}@#{node["somerepo"][:git_host]}/#{node["somerepo"][:git_owner]}/somerepo.git"
  revision "#{node["somerepo"][:git_revision]}"
  user "root"
  group "root"
end

我在 GitLab 存储库中有这几个标签,名称如下: 12022015 01052016 02042016

我想克隆/检查标签/02042016,就像我在 SVN 中设置的设置一样。请帮忙。我有点搜索了 StackOverflow,我希望我只是忽略了之前的一个这样的问题。如果这是不可能的,请告知。 :) 谢谢。

【问题讨论】:

  • 输入标签作为revision的参数?
  • @StephenKing 喜欢revision "tag/02042016" ?

标签: git svn version-control chef-infra gitlab


【解决方案1】:

正如documentation 建议的那样,您可以为revision 参数提供标签名称。

git "apt-cookbook" do
  repository "https://github.com/chef-cookbooks/apt"
  revision "v2.9.2"
  action :sync
end

由于revision参数的这种用法不是防弹的(不确定,当存在同名分支时会发生什么),您还可以提交完整的Git refspec标签,即@ 987654327@:

git "apt-cookbook" do
  repository "https://github.com/chef-cookbooks/apt"
  revision "refs/tags/v2.9.2"
  action :sync
end

【讨论】:

  • 我很确定这没关系。 Git 的标签(AFAIK)总是在refs/tags/* 中。这与 Git 服务器的 Web 界面等中的路径无关。回购是从repository 中的 URL 克隆的,然后签出 revision
  • 不,没关系。尝试例如代码here.
  • 在这种情况下我的记忆应该有问题:) 对不起
  • 如果标签和分支同时存在同名,我认为分支获胜。
  • @StephenKing 非常感谢。 refs/tags/<tagname> 解决了我遇到的问题!
猜你喜欢
  • 1970-01-01
  • 2020-09-28
  • 2013-12-15
  • 2018-03-07
  • 1970-01-01
  • 2013-11-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多