Chef - 从GitLab克隆特定标签

时间:2016-02-08 06:45:40

标签: git svn version-control chef gitlab

我有这个代码片段,我应该从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,我希望我只是忽略了之前的问题。如果这是不可能的,请善意提出建议。 :)谢谢。

1 个答案:

答案 0 :(得分:1)

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

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

由于revision参数的使用不是防弹(不确定,当存在同名分支时会发生什么),您还可以为标签提交完整的Git refspecrefs/tags/<tagname>

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