diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-03 15:08:33 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-03 15:08:33 +0000 |
commit | 511e761b41b81484c85e3d125f45873ce38e9201 (patch) | |
tree | 6bb98a6356de6e1d736951d2eef6ec83e6aa3dd2 /lib/api/internal | |
parent | 4247e67be1faa9d52691757dad954a7fa63e8bfe (diff) | |
download | gitlab-ce-511e761b41b81484c85e3d125f45873ce38e9201.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/internal')
-rw-r--r-- | lib/api/internal/base.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/api/internal/base.rb b/lib/api/internal/base.rb index 11f2a2ea1c0..d64de2bb465 100644 --- a/lib/api/internal/base.rb +++ b/lib/api/internal/base.rb @@ -6,6 +6,13 @@ module API class Base < Grape::API before { authenticate_by_gitlab_shell_token! } + before do + Gitlab::ApplicationContext.push( + user: -> { actor&.user }, + project: -> { project } + ) + end + helpers ::API::Helpers::InternalHelpers UNKNOWN_CHECK_RESULT_ERROR = 'Unknown check result'.freeze @@ -205,7 +212,12 @@ module API status 200 response = Gitlab::InternalPostReceive::Response.new + + # Try to load the project and users so we have the application context + # available for logging before we schedule any jobs. user = actor.user + project + push_options = Gitlab::PushOptions.new(params[:push_options]) response.reference_counter_decreased = Gitlab::ReferenceCounter.new(params[:gl_repository]).decrease |