Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-26 18:08:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-26 18:08:29 +0300
commitcac0926ddbef9d1505c2a23ccad60fd47c7d050a (patch)
treeef6808933314a104d004528f7c84716dc472d93a /lib
parentafd476d5fd62d31c7e0b7509691fa18e632a60df (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r--lib/api/personal_access_tokens.rb8
-rw-r--r--lib/gitlab/ci/config/external/file/local.rb4
-rw-r--r--lib/gitlab/ci/config/external/file/project.rb4
-rw-r--r--lib/gitlab/ci/config/external/file/remote.rb4
-rw-r--r--lib/gitlab/ci/config/external/file/template.rb4
-rw-r--r--lib/gitlab/usage/service_ping_report.rb2
6 files changed, 21 insertions, 5 deletions
diff --git a/lib/api/personal_access_tokens.rb b/lib/api/personal_access_tokens.rb
index 40e6486dae9..f8b744bb14b 100644
--- a/lib/api/personal_access_tokens.rb
+++ b/lib/api/personal_access_tokens.rb
@@ -54,6 +54,14 @@ module API
present paginate(tokens), with: Entities::PersonalAccessToken
end
+ get ':id' do
+ token = PersonalAccessToken.find_by_id(params[:id])
+
+ unauthorized! unless token && Ability.allowed?(current_user, :read_user_personal_access_tokens, token.user)
+
+ present token, with: Entities::PersonalAccessToken
+ end
+
delete 'self' do
revoke_token(access_token)
end
diff --git a/lib/gitlab/ci/config/external/file/local.rb b/lib/gitlab/ci/config/external/file/local.rb
index feb2cbb19ad..36fc5c656fc 100644
--- a/lib/gitlab/ci/config/external/file/local.rb
+++ b/lib/gitlab/ci/config/external/file/local.rb
@@ -42,7 +42,9 @@ module Gitlab
end
def fetch_local_content
- context.project.repository.blob_data_at(context.sha, location)
+ context.logger.instrument(:config_file_fetch_local_content) do
+ context.project.repository.blob_data_at(context.sha, location)
+ end
rescue GRPC::InvalidArgument
errors.push("Sha #{context.sha} is not valid!")
diff --git a/lib/gitlab/ci/config/external/file/project.rb b/lib/gitlab/ci/config/external/file/project.rb
index 09c36a1bcb6..b7fef081269 100644
--- a/lib/gitlab/ci/config/external/file/project.rb
+++ b/lib/gitlab/ci/config/external/file/project.rb
@@ -65,7 +65,9 @@ module Gitlab
return unless can_access_local_content?
return unless sha
- project.repository.blob_data_at(sha, location)
+ context.logger.instrument(:config_file_fetch_project_content) do
+ project.repository.blob_data_at(sha, location)
+ end
rescue GRPC::NotFound, GRPC::Internal
nil
end
diff --git a/lib/gitlab/ci/config/external/file/remote.rb b/lib/gitlab/ci/config/external/file/remote.rb
index 7d3a2362246..3984bf9e4f8 100644
--- a/lib/gitlab/ci/config/external/file/remote.rb
+++ b/lib/gitlab/ci/config/external/file/remote.rb
@@ -40,7 +40,9 @@ module Gitlab
def fetch_remote_content
begin
- response = Gitlab::HTTP.get(location)
+ response = context.logger.instrument(:config_file_fetch_remote_content) do
+ Gitlab::HTTP.get(location)
+ end
rescue SocketError
errors.push("Remote file `#{masked_location}` could not be fetched because of a socket error!")
rescue Timeout::Error
diff --git a/lib/gitlab/ci/config/external/file/template.rb b/lib/gitlab/ci/config/external/file/template.rb
index 58b81b259cb..5fcf7c71bdf 100644
--- a/lib/gitlab/ci/config/external/file/template.rb
+++ b/lib/gitlab/ci/config/external/file/template.rb
@@ -52,7 +52,9 @@ module Gitlab
end
def fetch_template_content
- Gitlab::Template::GitlabCiYmlTemplate.find(template_name, context.project)&.content
+ context.logger.instrument(:config_file_fetch_template_content) do
+ Gitlab::Template::GitlabCiYmlTemplate.find(template_name, context.project)&.content
+ end
end
def masked_raw
diff --git a/lib/gitlab/usage/service_ping_report.rb b/lib/gitlab/usage/service_ping_report.rb
index e73200cbd4a..1eda72ba570 100644
--- a/lib/gitlab/usage/service_ping_report.rb
+++ b/lib/gitlab/usage/service_ping_report.rb
@@ -24,7 +24,7 @@ module Gitlab
instrumented_payload = Gitlab::Usage::ServicePing::InstrumentedPayload.new(instrumented_metrics_key_paths, output_method).build
- old_payload.deep_merge(instrumented_payload)
+ old_payload.with_indifferent_access.deep_merge(instrumented_payload)
end
def all_metrics_values(cached)