Commit faae05ed authored by Jeroen Nijhof's avatar Jeroen Nijhof

Merge branch 'add_repo_key' into 'master'

Rewrite package url if key is set

See merge request !37
parents 00119a69 63254939
......@@ -2,8 +2,8 @@ default['omnibus-gitlab']['package']['url'] = 'https://downloads-packages.s3.ama
default['omnibus-gitlab']['package']['sha256'] = '42e8224f8aa8689ba80380d036a3b367ffb63a85b5e447670a5233d888b85924'
default['omnibus-gitlab']['package']['repo'] = 'gitlab/gitlab-ce'
default['omnibus-gitlab']['package']['key'] = nil
default['omnibus-gitlab']['package']['base_url'] = 'https://packages.gitlab.com'
default['omnibus-gitlab']['package']['base_url'] = "https://#{node['omnibus-gitlab']['package']['key']}:@packages.gitlab.com" if node['omnibus-gitlab']['package']['key']
default['omnibus-gitlab']['package']['base_url'] = 'packages.gitlab.com'
default['omnibus-gitlab']['package']['scheme_url'] = 'https'
default['omnibus-gitlab']['package']['name'] = 'gitlab-ce'
default['omnibus-gitlab']['package']['version'] = nil
default['omnibus-gitlab']['package']['timeout'] = nil
......
......@@ -14,14 +14,15 @@ attributes_with_secrets = if node['omnibus-gitlab']['data_bag']
GitLab::Vault.get(node, 'omnibus-gitlab')
end
pkg_base_url = node['omnibus-gitlab']['package']['base_url']
pkg_url = "#{node['omnibus-gitlab']['package']['scheme_url']}://#{node['omnibus-gitlab']['package']['base_url']}"
pkg_url = "#{node['omnibus-gitlab']['package']['scheme_url']}://#{attributes_with_secrets['package']['key']}:@#{node['omnibus-gitlab']['package']['base_url']}" if attributes_with_secrets['package']['key']
pkg_repo = node['omnibus-gitlab']['package']['repo']
package 'curl'
case node['platform_family']
when 'debian'
execute "add #{pkg_base_url}/#{pkg_repo} apt repo" do
command "curl #{pkg_base_url}/install/repositories/#{pkg_repo}/script.deb.sh | bash"
execute "add #{pkg_url}/#{pkg_repo} apt repo" do
command "curl #{pkg_url}/install/repositories/#{pkg_repo}/script.deb.sh | bash"
creates "/etc/apt/sources.list.d/#{pkg_repo.sub('/', '_')}.list"
end
......@@ -33,8 +34,8 @@ when 'debian'
notifies :run, 'execute[gitlab-ctl reconfigure]'
end
when 'rhel'
execute "add #{pkg_base_url}/#{pkg_repo} yum repo" do
command "curl #{pkg_base_url}/install/repositories/#{pkg_repo}/script.rpm.sh | bash"
execute "add #{pkg_url}/#{pkg_repo} yum repo" do
command "curl #{pkg_url}/install/repositories/#{pkg_repo}/script.rpm.sh | bash"
creates "/etc/yum.repos.d/#{pkg_repo.sub('/', '_')}.repo"
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment