Merge branch 'gitlab-shell-structured-logging'

MR: https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests/2385
This commit is contained in:
DJ Mountney 2018-03-23 06:49:59 -07:00
commit 3fa74479e6
No known key found for this signature in database
GPG Key ID: F07F8D51346CF0B6
6 changed files with 15 additions and 2 deletions

View File

@ -10,6 +10,7 @@ omnibus-gitlab repository.
registry (Takuya Noguchi)
- Internal: Speed up rubocop job (Takuya Noguchi)
- Excludes static libraries, header files, and `*-config` binaries from package.
- Render gitlab-shell log_format option
- Set proxy_http_version to ensure request buffering is disabled for GitLab Container Registry
10.6.0

View File

@ -643,6 +643,7 @@ external_url 'GENERATED_EXTERNAL_URL'
# gitlab_shell['audit_usernames'] = false
# gitlab_shell['log_level'] = 'INFO'
# gitlab_shell['log_format'] = 'json'
# gitlab_shell['http_settings'] = { user: 'username', password: 'password', ca_file: '/etc/ssl/cert.pem', ca_path: '/etc/pki/tls/certs', self_signed_cert: false}
# gitlab_shell['log_directory'] = "/var/log/gitlab/gitlab-shell/"
# gitlab_shell['custom_hooks_dir'] = "/opt/gitlab/embedded/service/gitlab-shell/hooks"

View File

@ -354,6 +354,7 @@ default['gitlab']['sidekiq']['listen_port'] = 8082
default['gitlab']['gitlab-shell']['dir'] = "/var/opt/gitlab/gitlab-shell"
default['gitlab']['gitlab-shell']['log_directory'] = "/var/log/gitlab/gitlab-shell/"
default['gitlab']['gitlab-shell']['log_level'] = nil
default['gitlab']['gitlab-shell']['log_format'] = nil
default['gitlab']['gitlab-shell']['audit_usernames'] = nil
default['gitlab']['gitlab-shell']['http_settings'] = nil
default['gitlab']['gitlab-shell']['auth_file'] = nil

View File

@ -82,6 +82,7 @@ templatesymlink "Create a config.yml and create a symlink to Rails root" do
redis_sentinels: node['gitlab']['gitlab-rails']['redis_sentinels'],
log_file: File.join(log_directory, "gitlab-shell.log"),
log_level: node['gitlab']['gitlab-shell']['log_level'],
log_format: node['gitlab']['gitlab-shell']['log_format'],
audit_usernames: node['gitlab']['gitlab-shell']['audit_usernames'],
http_settings: node['gitlab']['gitlab-shell']['http_settings'],
git_trace_log_file: node['gitlab']['gitlab-shell']['git_trace_log_file'],

View File

@ -45,6 +45,10 @@ log_file: "<%= @log_file %>"
# Log level. INFO by default
log_level: <%= @log_level %>
<% if @log_format %>
log_format: <%= @log_format %>
<% end %>
# Audit usernames.
# Set to true to see real usernames in the logs instead of key ids, which is easier to follow, but
# incurs an extra API call on every gitlab-shell command.

View File

@ -65,6 +65,7 @@ describe 'gitlab::gitlab-shell' do
%r{log_file: "/var/log/gitlab/gitlab-shell/gitlab-shell.log"}
)
expect(content).not_to match(/^custom_hooks_dir: /)
expect(content).not_to match(/^log_format: /)
}
end
end
@ -206,11 +207,13 @@ describe 'gitlab::gitlab-shell' do
end
end
end
context 'with non-default gitlab_hooks setting' do
context 'with custom settings' do
before do
stub_gitlab_rb(
gitlab_shell: {
custom_hooks_dir: '/fake/dir'
custom_hooks_dir: '/fake/dir',
log_format: 'json'
}
)
end
@ -218,6 +221,8 @@ describe 'gitlab::gitlab-shell' do
it 'populates with custom values' do
expect(chef_run).to render_file('/var/opt/gitlab/gitlab-shell/config.yml')
.with_content(%r{custom_hooks_dir: "/fake/dir"})
expect(chef_run).to render_file('/var/opt/gitlab/gitlab-shell/config.yml')
.with_content(%r{log_format: json})
end
end
end