Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2022-08-02 06:10:49 +00:00
parent fd1c75caeb
commit 347c7a7517
32 changed files with 112 additions and 163 deletions

View File

@ -164,32 +164,6 @@ Layout/HashAlignment:
- 'app/models/user_status.rb'
- 'app/models/wiki.rb'
- 'app/models/work_items/type.rb'
- 'app/presenters/analytics/cycle_analytics/stage_presenter.rb'
- 'app/presenters/project_presenter.rb'
- 'app/serializers/rollout_status_entity.rb'
- 'app/services/chat_names/authorize_user_service.rb'
- 'app/services/ci/archive_trace_service.rb'
- 'app/services/ci/job_artifacts/destroy_batch_service.rb'
- 'app/services/ci/list_config_variables_service.rb'
- 'app/services/ci/parse_dotenv_artifact_service.rb'
- 'app/services/ci/stuck_builds/drop_helpers.rb'
- 'app/services/groups/import_export/import_service.rb'
- 'app/services/issuable/import_csv/base_service.rb'
- 'app/services/issues/export_csv_service.rb'
- 'app/services/jira/requests/base.rb'
- 'app/services/merge_requests/mergeability_check_service.rb'
- 'app/services/merge_requests/push_options_handler_service.rb'
- 'app/services/merge_requests/toggle_attention_requested_service.rb'
- 'app/services/packages/conan/create_package_file_service.rb'
- 'app/services/packages/create_package_file_service.rb'
- 'app/services/packages/debian/create_package_file_service.rb'
- 'app/services/packages/npm/create_package_service.rb'
- 'app/services/projects/fork_service.rb'
- 'app/services/projects/lfs_pointers/lfs_download_service.rb'
- 'app/services/projects/update_remote_mirror_service.rb'
- 'app/uploaders/file_uploader.rb'
- 'app/workers/emails_on_push_worker.rb'
- 'app/workers/x509_issuer_crl_check_worker.rb'
- 'db/migrate/20210601080039_group_protected_environments_add_index_and_constraint.rb'
- 'db/migrate/20210804150320_create_base_work_item_types.rb'
- 'db/migrate/20210831203408_upsert_base_work_item_types.rb'
@ -207,14 +181,6 @@ Layout/HashAlignment:
- 'db/post_migrate/20210824174615_prepare_ci_builds_metadata_and_ci_build_async_indexes.rb'
- 'ee/app/controllers/ee/search_controller.rb'
- 'ee/app/controllers/projects/integrations/zentao/issues_controller.rb'
- 'ee/app/graphql/ee/types/board_list_type.rb'
- 'ee/app/graphql/ee/types/board_type.rb'
- 'ee/app/graphql/ee/types/ci/runner_type.rb'
- 'ee/app/graphql/ee/types/group_type.rb'
- 'ee/app/graphql/ee/types/issue_type.rb'
- 'ee/app/graphql/ee/types/merge_request_type.rb'
- 'ee/app/graphql/ee/types/project_type.rb'
- 'ee/app/graphql/ee/types/repository/blob_type.rb'
- 'ee/app/graphql/mutations/iterations/cadences/create.rb'
- 'ee/app/graphql/mutations/iterations/cadences/destroy.rb'
- 'ee/app/graphql/mutations/iterations/cadences/update.rb'
@ -248,8 +214,6 @@ Layout/HashAlignment:
- 'ee/app/graphql/types/vulnerability_location/sast_type.rb'
- 'ee/app/graphql/types/vulnerability_location/secret_detection_type.rb'
- 'ee/app/graphql/types/vulnerability_request_response_header_type.rb'
- 'ee/app/helpers/ee/feature_flags_helper.rb'
- 'ee/app/helpers/ee/sorting_helper.rb'
- 'ee/app/models/allowed_email_domain.rb'
- 'ee/app/models/ci/minutes/usage.rb'
- 'ee/app/models/ee/application_setting.rb'

View File

@ -1180,11 +1180,6 @@ Layout/LineLength:
- 'ee/app/graphql/ee/mutations/ci/runner/update.rb'
- 'ee/app/graphql/ee/mutations/issues/create.rb'
- 'ee/app/graphql/ee/resolvers/base_issues_resolver.rb'
- 'ee/app/graphql/ee/types/deprecated_mutations.rb'
- 'ee/app/graphql/ee/types/group_type.rb'
- 'ee/app/graphql/ee/types/merge_request_type.rb'
- 'ee/app/graphql/ee/types/project_type.rb'
- 'ee/app/graphql/ee/types/query_type.rb'
- 'ee/app/graphql/mutations/analytics/devops_adoption/enabled_namespaces/bulk_enable.rb'
- 'ee/app/graphql/mutations/audit_events/external_audit_event_destinations/create.rb'
- 'ee/app/graphql/mutations/audit_events/external_audit_event_destinations/update.rb'

View File

@ -355,9 +355,6 @@ group :development do
# Better errors handler
gem 'better_errors', '~> 2.9.0'
# thin instead webrick
gem 'thin', '~> 1.8.0'
gem 'sprite-factory', '~> 1.7'
end

View File

@ -257,7 +257,6 @@ GEM
git
css_parser (1.11.0)
addressable
daemons (1.3.1)
danger (8.6.1)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
@ -373,7 +372,6 @@ GEM
tzinfo
ethon (0.15.0)
ffi (>= 1.15.0)
eventmachine (1.2.7)
excon (0.90.0)
execjs (2.8.1)
expression_parser (0.9.0)
@ -1359,10 +1357,6 @@ GEM
test_file_finder (0.1.4)
faraday (~> 1.0)
text (1.3.1)
thin (1.8.0)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thor (1.2.1)
thrift (0.14.0)
tilt (2.0.10)
@ -1756,7 +1750,6 @@ DEPENDENCIES
terser (= 1.0.2)
test-prof (~> 1.0.7)
test_file_finder (~> 0.1.3)
thin (~> 1.8.0)
thrift (>= 0.14.0)
timecop (~> 0.9.1)
timfel-krb5-auth (~> 0.8)

View File

@ -28,7 +28,7 @@ module Analytics
description: _('Time before an issue gets scheduled')
},
plan: {
title: s_('CycleAnalyticsStage|Plan'),
title: s_('CycleAnalyticsStage|Plan'),
description: _('Time before an issue starts implementation')
},
code: {

View File

@ -437,9 +437,9 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
project_new_blob_path(
project,
default_branch_or_main,
file_name: file_name,
file_name: file_name,
commit_message: commit_message,
branch_name: branch_name,
branch_name: branch_name,
**additional_params
)
end

View File

@ -14,5 +14,5 @@ class RolloutStatusEntity < Grape::Entity
expose :completion, if: -> (rollout_status, _) { rollout_status.found? }
expose :complete?, as: :is_completed, if: -> (rollout_status, _) { rollout_status.found? }
expose :canary_ingress, using: RolloutStatuses::IngressEntity, expose_nil: false,
if: -> (rollout_status, _) { rollout_status.found? && rollout_status.canary_ingress_exists? }
if: -> (rollout_status, _) { rollout_status.found? && rollout_status.canary_ingress_exists? }
end

View File

@ -29,11 +29,11 @@ module ChatNames
def chat_name_params
{
service_id: @service.id,
team_id: @params[:team_id],
service_id: @service.id,
team_id: @params[:team_id],
team_domain: @params[:team_domain],
chat_id: @params[:user_id],
chat_name: @params[:user_name]
chat_id: @params[:user_id],
chat_name: @params[:user_name]
}
end
end

View File

@ -62,8 +62,8 @@ module Ci
failed_archive_counter.increment
Sidekiq.logger.warn(class: worker_name,
message: "Failed to archive trace. message: #{error.message}.",
job_id: job.id)
message: "Failed to archive trace. message: #{error.message}.",
job_id: job.id)
Gitlab::ErrorTracking
.track_and_raise_for_dev_exception(error,

View File

@ -54,7 +54,7 @@ module Ci
increment_monitoring_statistics(artifacts_count, artifacts_bytes)
success(destroyed_artifacts_count: artifacts_count,
statistics_updates: affected_project_statistics)
statistics_updates: affected_project_statistics)
end
# rubocop: enable CodeReuse/ActiveRecord

View File

@ -26,8 +26,8 @@ module Ci
return {} unless config
result = Gitlab::Ci::YamlProcessor.new(config, project: project,
user: current_user,
sha: sha).execute
user: current_user,
sha: sha).execute
result.valid? ? result.variables_with_data : {}
end

View File

@ -40,7 +40,7 @@ module Ci
key, value = scan_line!(line)
variables[key] = Ci::JobVariable.new(job_id: artifact.job_id,
source: :dotenv, key: key, value: value)
source: :dotenv, key: key, value: value)
end
end

View File

@ -56,12 +56,12 @@ module Ci
def log_dropping_message(type, build, reason)
Gitlab::AppLogger.info(class: self.class.name,
message: "Dropping #{type} build",
build_stuck_type: type,
build_id: build.id,
runner_id: build.runner_id,
build_status: build.status,
build_failure_reason: reason)
message: "Dropping #{type} build",
build_stuck_type: type,
build_id: build.id,
runner_id: build.runner_id,
build_status: build.status,
build_failure_reason: reason)
end
end
end

View File

@ -97,17 +97,17 @@ module Groups
def notify_success
@logger.info(
group_id: group.id,
group_id: group.id,
group_name: group.name,
message: 'Group Import/Export: Import succeeded'
message: 'Group Import/Export: Import succeeded'
)
end
def notify_error
@logger.error(
group_id: group.id,
group_id: group.id,
group_name: group.name,
message: "Group Import/Export: Errors occurred, see '#{Gitlab::ErrorTracking::Logger.file_name}' for details"
message: "Group Import/Export: Errors occurred, see '#{Gitlab::ErrorTracking::Logger.file_name}' for details"
)
end

View File

@ -22,9 +22,9 @@ module Issuable
def process_csv
with_csv_lines.each do |row, line_no|
issuable_attributes = {
title: row[:title],
title: row[:title],
description: row[:description],
due_date: row[:due_date]
due_date: row[:due_date]
}
if create_issuable(issuable_attributes).persisted?

View File

@ -25,24 +25,24 @@ module Issues
{
'Title' => 'title',
'Description' => 'description',
'Issue ID' => 'iid',
'URL' => -> (issue) { issue_url(issue) },
'State' => -> (issue) { issue.closed? ? 'Closed' : 'Open' },
'Author' => 'author_name',
'Author Username' => -> (issue) { issue.author&.username },
'Assignee' => -> (issue) { issue.assignees.map(&:name).join(', ') },
'Assignee Username' => -> (issue) { issue.assignees.map(&:username).join(', ') },
'Confidential' => -> (issue) { issue.confidential? ? 'Yes' : 'No' },
'Locked' => -> (issue) { issue.discussion_locked? ? 'Yes' : 'No' },
'Due Date' => -> (issue) { issue.due_date&.to_s(:csv) },
'Created At (UTC)' => -> (issue) { issue.created_at&.to_s(:csv) },
'Updated At (UTC)' => -> (issue) { issue.updated_at&.to_s(:csv) },
'Closed At (UTC)' => -> (issue) { issue.closed_at&.to_s(:csv) },
'Milestone' => -> (issue) { issue.milestone&.title },
'Weight' => -> (issue) { issue.weight },
'Labels' => -> (issue) { issue_labels(issue) },
'Time Estimate' => ->(issue) { issue.time_estimate.to_s(:csv) },
'Time Spent' => -> (issue) { issue_time_spent(issue) }
'Issue ID' => 'iid',
'URL' => -> (issue) { issue_url(issue) },
'State' => -> (issue) { issue.closed? ? 'Closed' : 'Open' },
'Author' => 'author_name',
'Author Username' => -> (issue) { issue.author&.username },
'Assignee' => -> (issue) { issue.assignees.map(&:name).join(', ') },
'Assignee Username' => -> (issue) { issue.assignees.map(&:username).join(', ') },
'Confidential' => -> (issue) { issue.confidential? ? 'Yes' : 'No' },
'Locked' => -> (issue) { issue.discussion_locked? ? 'Yes' : 'No' },
'Due Date' => -> (issue) { issue.due_date&.to_s(:csv) },
'Created At (UTC)' => -> (issue) { issue.created_at&.to_s(:csv) },
'Updated At (UTC)' => -> (issue) { issue.updated_at&.to_s(:csv) },
'Closed At (UTC)' => -> (issue) { issue.closed_at&.to_s(:csv) },
'Milestone' => -> (issue) { issue.milestone&.title },
'Weight' => -> (issue) { issue.weight },
'Labels' => -> (issue) { issue_labels(issue) },
'Time Estimate' => ->(issue) { issue.time_estimate.to_s(:csv) },
'Time Spent' => -> (issue) { issue_time_spent(issue) }
}
end

View File

@ -9,10 +9,10 @@ module Jira
ERRORS = {
connection: [Errno::ECONNRESET, Errno::ECONNREFUSED],
jira_ruby: JIRA::HTTPError,
ssl: OpenSSL::SSL::SSLError,
timeout: [Timeout::Error, Errno::ETIMEDOUT],
uri: [URI::InvalidURIError, SocketError]
jira_ruby: JIRA::HTTPError,
ssl: OpenSSL::SSL::SSLError,
timeout: [Timeout::Error, Errno::ETIMEDOUT],
uri: [URI::InvalidURIError, SocketError]
}.freeze
ALL_ERRORS = ERRORS.values.flatten.freeze

View File

@ -78,8 +78,8 @@ module MergeRequests
lease_key = "mergeability_check:#{merge_request.id}"
lease_opts = {
ttl: 1.minute,
retries: retry_lease ? 10 : 0,
ttl: 1.minute,
retries: retry_lease ? 10 : 0,
sleep_sec: retry_lease ? 1.second : 0
}

View File

@ -105,7 +105,7 @@ module MergeRequests
project: project,
current_user: current_user,
params: merge_request.attributes.merge(assignees: merge_request.assignees,
label_ids: merge_request.label_ids)
label_ids: merge_request.label_ids)
).execute
end

View File

@ -62,7 +62,7 @@ module MergeRequests
def update_state(reviewer_or_assignee)
reviewer_or_assignee&.update(state: reviewer_or_assignee&.attention_requested? ? :reviewed : :attention_requested,
updated_state_by: current_user)
updated_state_by: current_user)
end
end
end

View File

@ -13,11 +13,11 @@ module Packages
def execute
package_file = package.package_files.build(
file: file,
size: params['file.size'],
file: file,
size: params['file.size'],
file_name: params[:file_name],
file_sha1: params['file.sha1'],
file_md5: params['file.md5'],
file_md5: params['file.md5'],
conan_file_metadatum_attributes: {
recipe_revision: params[:recipe_revision],
package_revision: params[:package_revision],

View File

@ -10,12 +10,12 @@ module Packages
def execute
package_file = package.package_files.build(
file: params[:file],
size: params[:size],
file_name: params[:file_name],
file_sha1: params[:file_sha1],
file: params[:file],
size: params[:size],
file_name: params[:file_name],
file_sha1: params[:file_sha1],
file_sha256: params[:file_sha256],
file_md5: params[:file_md5]
file_md5: params[:file_md5]
)
if params[:build].present?

View File

@ -17,12 +17,12 @@ module Packages
# Debian package file are first uploaded to incoming with empty metadata,
# and are moved later by Packages::Debian::ProcessChangesService
package.package_files.create!(
file: params[:file],
size: params[:file]&.size,
file_name: params[:file_name],
file_sha1: params[:file_sha1],
file: params[:file],
size: params[:file]&.size,
file_name: params[:file_name],
file_sha1: params[:file_sha1],
file_sha256: params[:file]&.sha256,
file_md5: params[:file_md5],
file_md5: params[:file_md5],
debian_file_metadatum_attributes: {
file_type: 'unknown',
architecture: nil,

View File

@ -87,11 +87,11 @@ module Packages
def file_params
{
file: CarrierWaveStringFile.new(Base64.decode64(attachment['data'])),
size: calculated_package_file_size,
file: CarrierWaveStringFile.new(Base64.decode64(attachment['data'])),
size: calculated_package_file_size,
file_sha1: version_data[:dist][:shasum],
file_name: package_file_name,
build: params[:build]
build: params[:build]
}
end

View File

@ -46,15 +46,15 @@ module Projects
def new_fork_params
new_params = {
forked_from_project: @project,
visibility_level: target_visibility_level,
description: target_description,
name: target_name,
path: target_path,
shared_runners_enabled: @project.shared_runners_enabled,
namespace_id: target_namespace.id,
fork_network: fork_network,
ci_config_path: @project.ci_config_path,
forked_from_project: @project,
visibility_level: target_visibility_level,
description: target_description,
name: target_name,
path: target_path,
shared_runners_enabled: @project.shared_runners_enabled,
namespace_id: target_namespace.id,
fork_network: fork_network,
ci_config_path: @project.ci_config_path,
# We need to set ci_default_git_depth to 0 for the forked project when
# @project.ci_default_git_depth is nil in order to keep the same behaviour
# and not get ProjectCiCdSetting::DEFAULT_GIT_DEPTH set on create
@ -63,8 +63,8 @@ module Projects
# been instantiated to avoid ActiveRecord trying to create it when
# initializing the project, as that would cause a foreign key constraint
# exception.
relations_block: -> (project) { build_fork_network_member(project) },
skip_disk_validation: skip_disk_validation,
relations_block: -> (project) { build_fork_network_member(project) },
skip_disk_validation: skip_disk_validation,
external_authorization_classification_label: @project.external_authorization_classification_label,
suggestion_commit_message: @project.suggestion_commit_message,
merge_commit_template: @project.merge_commit_template,

View File

@ -50,7 +50,7 @@ module Projects
def find_or_create_lfs_object(tmp_file)
lfs_obj = LfsObject.safe_find_or_create_by!(
oid: lfs_oid,
oid: lfs_oid,
size: lfs_size
)

View File

@ -76,11 +76,11 @@ module Projects
if message.present?
Gitlab::AppJsonLogger.info(message: "Error synching remote mirror",
project_id: project.id,
project_path: project.full_path,
remote_mirror_id: remote_mirror.id,
lfs_sync_failed: lfs_sync_failed,
divergent_ref_list: response.divergent_refs)
project_id: project.id,
project_path: project.full_path,
remote_mirror_id: remote_mirror.id,
lfs_sync_failed: lfs_sync_failed,
divergent_ref_list: response.divergent_refs)
end
[failed, message]

View File

@ -142,8 +142,8 @@ class FileUploader < GitlabUploader
def to_h
{
alt: markdown_name,
url: secure_url,
alt: markdown_name,
url: secure_url,
markdown: markdown_link
}
end

View File

@ -17,8 +17,8 @@ class EmailsOnPushWorker # rubocop:disable Scalability/IdempotentWorker
def perform(project_id, recipients, push_data, options = {})
options.symbolize_keys!
options.reverse_merge!(
send_from_committer_email: false,
disable_diffs: false
send_from_committer_email: false,
disable_diffs: false
)
send_from_committer_email = options[:send_from_committer_email]
disable_diffs = options[:disable_diffs]
@ -64,14 +64,14 @@ class EmailsOnPushWorker # rubocop:disable Scalability/IdempotentWorker
send_email(
recipient,
project_id,
author_id: author_id,
ref: ref,
action: action,
compare: compare,
reverse_compare: reverse_compare,
diff_refs: diff_refs,
author_id: author_id,
ref: ref,
action: action,
compare: compare,
reverse_compare: reverse_compare,
diff_refs: diff_refs,
send_from_committer_email: send_from_committer_email,
disable_diffs: disable_diffs
disable_diffs: disable_diffs
)
# These are input errors and won't be corrected even if Sidekiq retries

View File

@ -41,13 +41,13 @@ class X509IssuerCrlCheckWorker
certs.find_each do |cert|
logger.info(message: "Certificate revoked",
id: cert.id,
email: cert.email,
subject: cert.subject,
serial_number: cert.serial_number,
issuer: cert.x509_issuer.id,
issuer_subject: cert.x509_issuer.subject,
issuer_crl_url: cert.x509_issuer.crl_url)
id: cert.id,
email: cert.email,
subject: cert.subject,
serial_number: cert.serial_number,
issuer: cert.x509_issuer.id,
issuer_subject: cert.x509_issuer.subject,
issuer_crl_url: cert.x509_issuer.crl_url)
end
certs.update_all(certificate_status: :revoked)
@ -61,18 +61,18 @@ class X509IssuerCrlCheckWorker
OpenSSL::X509::CRL.new(response.body)
else
logger.warn(message: "Failed to download certificate revocation list",
issuer: issuer.id,
issuer_subject: issuer.subject,
issuer_crl_url: issuer.crl_url)
issuer: issuer.id,
issuer_subject: issuer.subject,
issuer_crl_url: issuer.crl_url)
nil
end
rescue OpenSSL::X509::CRLError
logger.warn(message: "Failed to parse certificate revocation list",
issuer: issuer.id,
issuer_subject: issuer.subject,
issuer_crl_url: issuer.crl_url)
issuer: issuer.id,
issuer_subject: issuer.subject,
issuer_crl_url: issuer.crl_url)
nil
end

View File

@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/364497
milestone: '15.1'
type: development
group: group::code review
default_enabled: false
default_enabled: true

View File

@ -118,8 +118,8 @@ Is the cache being added "worthy"? This can be hard to measure, but you can cons
- `tail -f log/development.log | grep "Rendered "`
- After you're looking in the right place:
- Remove or comment out sections of code until you find the cause.
- Use `binding.pry` to poke about in live requests. This requires a foreground
web process like [Thin](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/pry.md).
- Use `binding.pry` to poke about in live requests. This requires a
[foreground web process](https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/pry.md).
#### Verification