Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
ea4234ea568d
Commit
04750438
authored
Mar 13, 2020
by
GitLab Bot
Browse files
Add latest changes from gitlab-org/gitlab@master
parent
497e898831d3
Changes
80
Hide whitespace changes
Inline
Side-by-side
app/assets/javascripts/monitoring/components/embed.vue
View file @
ea4234ea
...
...
@@ -67,7 +67,7 @@ export default {
'
setShowErrorBanner
'
,
]),
chartHasData
(
chart
)
{
return
chart
.
metrics
.
some
(
metric
=>
this
.
metricsWithData
().
includes
(
metric
.
metric
_i
d
));
return
chart
.
metrics
.
some
(
metric
=>
this
.
metricsWithData
().
includes
(
metric
.
metric
I
d
));
},
onSidebarMutation
()
{
setTimeout
(()
=>
{
...
...
app/assets/javascripts/monitoring/stores/utils.js
View file @
ea4234ea
...
...
@@ -13,11 +13,12 @@ export const gqClient = createGqClient(
/**
* Metrics loaded from project-defined dashboards do not have a metric_id.
* This method creates a unique ID combining metric_id and id, if either is present.
* This is hopefully a temporary solution until BE processes metrics before passing to
f
E
* This is hopefully a temporary solution until BE processes metrics before passing to
F
E
* @param {Object} metric - metric
* @returns {Object} - normalized metric with a uniqueID
*/
export
const
uniqMetricsId
=
metric
=>
`
${
metric
.
metric_id
}
_
${
metric
.
id
}
`
;
// eslint-disable-next-line babel/camelcase
export
const
uniqMetricsId
=
({
metric_id
,
id
})
=>
`
${
metric_id
}
_
${
id
}
`
;
/**
* Project path has a leading slash that doesn't work well
...
...
@@ -68,10 +69,6 @@ const mapToMetricsViewModel = (metrics, defaultLabel) =>
queryRange
:
query_range
,
prometheusEndpointPath
:
prometheus_endpoint_path
,
metricId
:
uniqMetricsId
({
metric_id
,
id
}),
// `metric_id` is used by embed.vue, keeping this duplicated.
// https://gitlab.com/gitlab-org/gitlab/issues/37492
metric_id
:
uniqMetricsId
({
metric_id
,
id
}),
...
metric
,
}));
...
...
app/controllers/projects/logs_controller.rb
View file @
ea4234ea
...
...
@@ -48,7 +48,7 @@ def k8s_params
end
def
elasticsearch_params
params
.
permit
(
:container_name
,
:pod_name
,
:search
,
:start
,
:end
)
params
.
permit
(
:container_name
,
:pod_name
,
:search
,
:start
,
:end
,
:cursor
)
end
def
environment
...
...
app/models/issue.rb
View file @
ea4234ea
...
...
@@ -77,7 +77,7 @@ class Issue < ApplicationRecord
scope
:counts_by_state
,
->
{
reorder
(
nil
).
group
(
:state_id
).
count
}
ignore_column
:state
,
remove_with:
'12.
7
'
,
remove_after:
'20
19-12
-22'
ignore_column
:state
,
remove_with:
'12.
10
'
,
remove_after:
'20
20-03
-22'
after_commit
:expire_etag_cache
,
unless: :importing?
after_save
:ensure_metrics
,
unless: :importing?
...
...
app/models/merge_request.rb
View file @
ea4234ea
...
...
@@ -261,7 +261,7 @@ def check_state?(merge_status)
includes
(
:metrics
)
end
ignore_column
:state
,
remove_with:
'12.
7
'
,
remove_after:
'20
19-12
-22'
ignore_column
:state
,
remove_with:
'12.
10
'
,
remove_after:
'20
20-03
-22'
after_save
:keep_around_commit
,
unless: :importing?
...
...
app/models/project_services/jira_service.rb
View file @
ea4234ea
...
...
@@ -280,21 +280,17 @@ def send_message(issue, message, remote_link_props)
return
unless
client_url
.
present?
jira_request
do
create_issue_link
(
issue
,
remote_link_props
)
create_issue_comment
(
issue
,
message
)
remote_link
=
find_remote_link
(
issue
,
remote_link_props
[
:object
][
:url
])
create_issue_comment
(
issue
,
message
)
unless
remote_link
remote_link
||=
issue
.
remotelink
.
build
remote_link
.
save!
(
remote_link_props
)
log_info
(
"Successfully posted"
,
client_url:
client_url
)
"SUCCESS: Successfully posted to
#{
client_url
}
."
end
end
def
create_issue_link
(
issue
,
remote_link_props
)
remote_link
=
find_remote_link
(
issue
,
remote_link_props
[
:object
][
:url
])
remote_link
||=
issue
.
remotelink
.
build
remote_link
.
save!
(
remote_link_props
)
end
def
create_issue_comment
(
issue
,
message
)
return
unless
comment_on_event_enabled
...
...
app/models/x509_certificate.rb
View file @
ea4234ea
...
...
@@ -2,6 +2,7 @@
class
X509Certificate
<
ApplicationRecord
include
X509SerialNumberAttribute
include
AfterCommitQueue
x509_serial_number_attribute
:serial_number
...
...
@@ -25,8 +26,14 @@ class X509Certificate < ApplicationRecord
validates
:x509_issuer_id
,
presence:
true
after_commit
:mark_commit_signatures_unverified
def
self
.
safe_create!
(
attributes
)
create_with
(
attributes
)
.
safe_find_or_create_by!
(
subject_key_identifier:
attributes
[
:subject_key_identifier
])
end
def
mark_commit_signatures_unverified
X509CertificateRevokeWorker
.
perform_async
(
self
.
id
)
if
revoked?
end
end
app/services/pod_logs/base_service.rb
View file @
ea4234ea
...
...
@@ -10,8 +10,6 @@ class BaseService < ::BaseService
CACHE_KEY_GET_POD_LOG
=
'get_pod_log'
K8S_NAME_MAX_LENGTH
=
253
SUCCESS_RETURN_KEYS
=
%i(status logs pod_name container_name pods)
.
freeze
def
id
cluster
.
id
end
...
...
@@ -49,6 +47,10 @@ def valid_params
%w(pod_name container_name)
end
def
success_return_keys
%i(status logs pod_name container_name pods)
end
def
check_arguments
(
result
)
return
error
(
_
(
'Cluster does not exist'
))
if
cluster
.
nil?
return
error
(
_
(
'Namespace is empty'
))
if
namespace
.
blank?
...
...
@@ -122,7 +124,7 @@ def pod_logs(result)
end
def
filter_return_keys
(
result
)
result
.
slice
(
*
SUCCESS_RETURN_KEYS
)
result
.
slice
(
*
success_return_keys
)
end
def
filter_params
(
params
)
...
...
app/services/pod_logs/elasticsearch_service.rb
View file @
ea4234ea
...
...
@@ -10,6 +10,7 @@ class ElasticsearchService < PodLogs::BaseService
:check_container_name
,
:check_times
,
:check_search
,
:check_cursor
,
:pod_logs
,
:filter_return_keys
...
...
@@ -18,7 +19,11 @@ class ElasticsearchService < PodLogs::BaseService
private
def
valid_params
%w(pod_name container_name search start end)
super
+
%w(search start end cursor)
end
def
success_return_keys
super
+
%i(cursor)
end
def
check_times
(
result
)
...
...
@@ -36,19 +41,28 @@ def check_search(result)
success
(
result
)
end
def
check_cursor
(
result
)
result
[
:cursor
]
=
params
[
'cursor'
]
if
params
.
key?
(
'cursor'
)
success
(
result
)
end
def
pod_logs
(
result
)
client
=
cluster
&
.
application_elastic_stack
&
.
elasticsearch_client
return
error
(
_
(
'Unable to connect to Elasticsearch'
))
unless
client
res
ult
[
:logs
]
=
::
Gitlab
::
Elasticsearch
::
Logs
.
new
(
client
).
pod_logs
(
res
ponse
=
::
Gitlab
::
Elasticsearch
::
Logs
.
new
(
client
).
pod_logs
(
namespace
,
result
[
:pod_name
],
result
[
:container_name
],
result
[
:search
],
result
[
:start
],
result
[
:end
]
container_name:
result
[
:container_name
],
search:
result
[
:search
],
start_time:
result
[
:start
],
end_time:
result
[
:end
],
cursor:
result
[
:cursor
]
)
result
.
merge!
(
response
)
success
(
result
)
rescue
Elasticsearch
::
Transport
::
Transport
::
ServerError
=>
e
::
Gitlab
::
ErrorTracking
.
track_exception
(
e
)
...
...
@@ -58,6 +72,8 @@ def pod_logs(result)
# there is no method on the exception other than the class name to determine the type of error encountered.
status_code:
e
.
class
.
name
.
split
(
'::'
).
last
})
rescue
::
Gitlab
::
Elasticsearch
::
Logs
::
InvalidCursor
error
(
_
(
'Invalid cursor value provided'
))
end
end
end
app/services/projects/update_repository_storage_service.rb
View file @
ea4234ea
...
...
@@ -5,19 +5,12 @@ class UpdateRepositoryStorageService < BaseService
include
Gitlab
::
ShellAdapter
Error
=
Class
.
new
(
StandardError
)
RepositoryAlreadyMoved
=
Class
.
new
(
StandardError
)
def
initialize
(
project
)
@project
=
project
end
def
execute
(
new_repository_storage_key
)
# Raising an exception is a little heavy handed but this behavior (doing
# nothing if the repo is already on the right storage) prevents data
# loss, so it is valuable for us to be able to observe it via the
# exception.
raise
RepositoryAlreadyMoved
if
project
.
repository_storage
==
new_repository_storage_key
mirror_repositories
(
new_repository_storage_key
)
mark_old_paths_for_archive
...
...
@@ -30,7 +23,7 @@ def execute(new_repository_storage_key)
success
rescue
Error
=>
e
rescue
Error
,
ArgumentError
,
Gitlab
::
Git
::
BaseError
=>
e
project
.
update
(
repository_read_only:
false
)
Gitlab
::
ErrorTracking
.
track_exception
(
e
,
project_path:
project
.
full_path
)
...
...
@@ -65,10 +58,7 @@ def mirror_repository(new_storage_key, type: Gitlab::GlRepository::PROJECT)
raw_repository
.
gl_repository
,
full_path
)
unless
new_repository
.
fetch_repository_as_mirror
(
raw_repository
)
raise
Error
,
s_
(
'UpdateRepositoryStorage|Failed to fetch %{type} repository as mirror'
)
%
{
type:
type
.
name
}
end
new_repository
.
replicate
(
raw_repository
)
new_checksum
=
new_repository
.
checksum
if
checksum
!=
new_checksum
...
...
app/services/x509_certificate_revoke_service.rb
0 → 100644
View file @
ea4234ea
# frozen_string_literal: true
class
X509CertificateRevokeService
def
execute
(
certificate
)
return
unless
certificate
.
revoked?
certificate
.
x509_commit_signatures
.
update_all
(
verification_status: :unverified
)
end
end
app/uploaders/attachment_uploader.rb
View file @
ea4234ea
...
...
@@ -11,4 +11,15 @@ class AttachmentUploader < GitlabUploader
def
dynamic_segment
File
.
join
(
model
.
class
.
underscore
,
mounted_as
.
to_s
,
model
.
id
.
to_s
)
end
def
mounted_as
# Geo fails to sync attachments on Note, and LegacyDiffNotes with missing mount_point.
#
# See https://gitlab.com/gitlab-org/gitlab/-/issues/209752 for more details.
if
model
.
class
.
underscore
.
include?
(
'note'
)
super
||
'attachment'
else
super
end
end
end
app/views/projects/commit/x509/_certificate_details.html.haml
View file @
ea4234ea
.gpg-popover-certificate-details
%strong
=
_
(
'Certificate Subject'
)
-
if
signature
.
x509_certificate
.
revoked?
%strong
.cred
=
_
(
'(revoked)'
)
%ul
-
x509_subject
(
signature
.
x509_certificate
.
subject
,
[
"CN"
,
"O"
]).
map
do
|
key
,
value
|
%li
=
key
+
"="
+
value
...
...
app/workers/all_queues.yml
View file @
ea4234ea
...
...
@@ -1291,3 +1291,10 @@
:resource_boundary: :unknown
:weight:
1
:idempotent:
-
:name: x509_certificate_revoke
:feature_category: :source_code_management
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight:
1
:idempotent:
true
app/workers/project_update_repository_storage_worker.rb
View file @
ea4234ea
...
...
@@ -9,7 +9,5 @@ def perform(project_id, new_repository_storage_key)
project
=
Project
.
find
(
project_id
)
::
Projects
::
UpdateRepositoryStorageService
.
new
(
project
).
execute
(
new_repository_storage_key
)
rescue
::
Projects
::
UpdateRepositoryStorageService
::
RepositoryAlreadyMoved
Rails
.
logger
.
info
"
#{
self
.
class
}
: repository already moved:
#{
project
}
"
# rubocop:disable Gitlab/RailsLogger
end
end
app/workers/x509_certificate_revoke_worker.rb
0 → 100644
View file @
ea4234ea
# frozen_string_literal: true
class
X509CertificateRevokeWorker
include
ApplicationWorker
feature_category
:source_code_management
idempotent!
def
perform
(
certificate_id
)
return
unless
certificate_id
X509Certificate
.
find_by_id
(
certificate_id
).
try
do
|
certificate
|
X509CertificateRevokeService
.
new
.
execute
(
certificate
)
end
end
end
changelogs/unreleased/198326-migrate-commit-notes-mentions-to-db-table.yml
0 → 100644
View file @
ea4234ea
---
title
:
Migrate mentions for commit notes to commit_user_mentions DB table
merge_request
:
23859
author
:
type
:
changed
changelogs/unreleased/208403-attachment-file-not-found.yml
0 → 100644
View file @
ea4234ea
---
title
:
Ensure valid mount point is used by attachments on notes
merge_request
:
26849
author
:
type
:
fixed
changelogs/unreleased/a11y-gitlab-script.yml
0 → 100644
View file @
ea4234ea
---
title
:
Generate JSON-formatted a11y CI artifacts
merge_request
:
26687
author
:
type
:
added
changelogs/unreleased/drop_old_state_column_from_issues.yml
0 → 100644
View file @
ea4234ea
---
title
:
Remove state column from issues and merge_requests
merge_request
:
25561
author
:
type
:
deprecated
Prev
1
2
3
4
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment