Resolve "Registry internal key populate should be in Rails recipe"
This commit is contained in:
parent
cf5b0ee76c
commit
683bdcfb4b
|
@ -111,6 +111,14 @@ directory gitlab_ci_dir do
|
|||
recursive true
|
||||
end
|
||||
|
||||
key_file_path = node['gitlab']['gitlab-rails']['registry_key_path']
|
||||
file key_file_path do
|
||||
content node['registry']['internal_key']
|
||||
owner gitlab_user
|
||||
group gitlab_group
|
||||
only_if { node['gitlab']['gitlab-rails']['registry_enabled'] && node['registry']['internal_key'] }
|
||||
end
|
||||
|
||||
template File.join(gitlab_rails_static_etc_dir, "gitlab-rails-rc")
|
||||
|
||||
dependent_services = []
|
||||
|
|
|
@ -57,13 +57,6 @@ directory node['gitlab']['gitlab-rails']['registry_path'] do
|
|||
only_if { node['gitlab']['manage-storage-directories']['enable'] }
|
||||
end
|
||||
|
||||
key_file_path = node['gitlab']['gitlab-rails']['registry_key_path']
|
||||
file key_file_path do
|
||||
content node['registry']['internal_key']
|
||||
owner account_helper.gitlab_user
|
||||
group account_helper.gitlab_group
|
||||
end
|
||||
|
||||
cert_file_path = File.join(working_dir, "gitlab-registry.crt")
|
||||
node.default['registry']['rootcertbundle'] = cert_file_path
|
||||
file cert_file_path do
|
||||
|
|
|
@ -655,4 +655,25 @@ describe 'gitlab::gitlab-rails' do
|
|||
end
|
||||
end
|
||||
end
|
||||
context 'gitlab registry' do
|
||||
describe 'registry is disabled' do
|
||||
it 'does not generate gitlab-registry.key file' do
|
||||
expect(chef_run).not_to render_file("/var/opt/gitlab/gitlab-rails/etc/gitlab-registry.key")
|
||||
end
|
||||
end
|
||||
|
||||
describe 'registry is enabled' do
|
||||
before do
|
||||
stub_gitlab_rb(
|
||||
gitlab_rails: {
|
||||
registry_enabled: true
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
it 'generates gitlab-registry.key file' do
|
||||
expect(chef_run).to render_file("/var/opt/gitlab/gitlab-rails/etc/gitlab-registry.key").with_content(/\A-----BEGIN RSA PRIVATE KEY-----\n.+\n-----END RSA PRIVATE KEY-----\n\Z/m)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue