Add an option to add keys for bitbucket importer.
This commit is contained in:
parent
c5e516392f
commit
c8c720f970
|
@ -84,6 +84,17 @@ external_url 'GENERATED_EXTERNAL_URL'
|
|||
# "args" => { "access_type" => "offline", "approval_prompt" => "" }
|
||||
# }
|
||||
# ]
|
||||
#
|
||||
# If you setup bitbucket importer under omniauth providers you will need to add the keys
|
||||
# which will allow connection between bitbucket and gitlab.
|
||||
# For details see http://doc.gitlab.com/ce/integration/bitbucket.html
|
||||
# gitlab_rails['bitbucket'] = {
|
||||
# 'known_hosts_key' => 'bitbucket.org,207.223.240.182 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==',
|
||||
# 'private_key' => '-----BEGIN RSA PRIVATE KEY-----
|
||||
# MIIEowIBAAKCAQEAyXxYHwz2KjcwSjTREwlhYHqrf/8U0UM8ej3cqQ551gE4Wo3t
|
||||
# -----END RSA PRIVATE KEY-----',
|
||||
# 'public_key' => 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDJfFgfDPYqN git@gitlab.example.com'
|
||||
# }
|
||||
|
||||
## For setting up backups
|
||||
## see https://gitlab.com/gitlab-org/omnibus-gitlab/blob/629def0a7a26e7c2326566f0758d4a27857b52a3/README.md#backups
|
||||
|
|
|
@ -105,6 +105,7 @@ default['gitlab']['gitlab-rails']['omniauth_enabled'] = false
|
|||
default['gitlab']['gitlab-rails']['omniauth_allow_single_sign_on'] = nil
|
||||
default['gitlab']['gitlab-rails']['omniauth_block_auto_created_users'] = nil
|
||||
default['gitlab']['gitlab-rails']['omniauth_providers'] = []
|
||||
default['gitlab']['gitlab-rails']['bitbucket'] = nil
|
||||
default['gitlab']['gitlab-rails']['satellites_path'] = "/var/opt/gitlab/git-data/gitlab-satellites"
|
||||
default['gitlab']['gitlab-rails']['satellites_timeout'] = nil
|
||||
default['gitlab']['gitlab-rails']['backup_path'] = "/var/opt/gitlab/backups"
|
||||
|
|
|
@ -24,6 +24,8 @@ gitlab_rails_working_dir = File.join(gitlab_rails_dir, "working")
|
|||
gitlab_rails_tmp_dir = File.join(gitlab_rails_dir, "tmp")
|
||||
gitlab_rails_public_uploads_dir = node['gitlab']['gitlab-rails']['uploads_directory']
|
||||
gitlab_rails_log_dir = node['gitlab']['gitlab-rails']['log_directory']
|
||||
ssh_dir = File.join(node['gitlab']['user']['home'], ".ssh")
|
||||
known_hosts = File.join(ssh_dir, "known_hosts")
|
||||
gitlab_app = "gitlab"
|
||||
|
||||
# Needed for .gitlab_shell_secret
|
||||
|
@ -233,3 +235,28 @@ execute "clear the gitlab-rails cache" do
|
|||
command "/opt/gitlab/bin/gitlab-rake cache:clear"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
bitbucket_keys = node['gitlab']['gitlab-rails']['bitbucket']
|
||||
|
||||
unless bitbucket_keys.nil?
|
||||
execute 'trust bitbucket.org fingerprint' do
|
||||
command "echo '#{bitbucket_keys['known_hosts_key']}' >> #{known_hosts}"
|
||||
user node['gitlab']['user']['username']
|
||||
group node['gitlab']['user']['group']
|
||||
not_if "grep '#{bitbucket_keys['known_hosts_key']}' #{known_hosts}"
|
||||
end
|
||||
|
||||
file File.join(ssh_dir, 'bitbucket_rsa') do
|
||||
content "#{bitbucket_keys['private_key']}\n"
|
||||
owner node['gitlab']['user']['username']
|
||||
group node['gitlab']['user']['group']
|
||||
mode 0600
|
||||
end
|
||||
|
||||
file File.join(ssh_dir, 'bitbucket_rsa.pub') do
|
||||
content "#{bitbucket_keys['public_key']}\n"
|
||||
owner node['gitlab']['user']['username']
|
||||
group node['gitlab']['user']['group']
|
||||
mode 0644
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue