Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
53a3791717
commit
52b1470ada
|
@ -142,6 +142,7 @@ Style/FormatString:
|
|||
- 'app/presenters/ci/pipeline_presenter.rb'
|
||||
- 'app/presenters/merge_request_presenter.rb'
|
||||
- 'app/presenters/project_presenter.rb'
|
||||
- 'app/presenters/key_presenter.rb'
|
||||
- 'app/serializers/build_details_entity.rb'
|
||||
- 'app/services/alert_management/alerts/update_service.rb'
|
||||
- 'app/services/boards/lists/base_create_service.rb'
|
||||
|
|
|
@ -81,10 +81,9 @@ export default {
|
|||
},
|
||||
},
|
||||
i18n: {
|
||||
deleteModalContent: s__(
|
||||
'PackageRegistry|You are about to delete %{name}, this operation is irreversible, are you sure?',
|
||||
),
|
||||
modalAction: s__('PackageRegistry|Delete package'),
|
||||
deleteModalContent: s__('PackageRegistry|You are about to delete %{name}, are you sure?'),
|
||||
modalTitle: s__('PackageRegistry|Delete package'),
|
||||
modalAction: s__('PackageRegistry|Permanently delete'),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -120,13 +119,13 @@ export default {
|
|||
<gl-modal
|
||||
ref="packageListDeleteModal"
|
||||
size="sm"
|
||||
modal-id="confirm-delete-pacakge"
|
||||
modal-id="confirm-delete-package"
|
||||
:action-primary="deleteModalActionPrimaryProps"
|
||||
:action-cancel="deleteModalActionCancelProps"
|
||||
@ok="deleteItemConfirmation"
|
||||
@cancel="deleteItemCanceled"
|
||||
>
|
||||
<template #modal-title>{{ $options.i18n.modalAction }}</template>
|
||||
<template #modal-title>{{ $options.i18n.modalTitle }}</template>
|
||||
<gl-sprintf :message="$options.i18n.deleteModalContent">
|
||||
<template #name>
|
||||
<strong>{{ deletePackageName }}</strong>
|
||||
|
|
|
@ -122,10 +122,9 @@ export default {
|
|||
},
|
||||
},
|
||||
i18n: {
|
||||
deleteModalContent: s__(
|
||||
'PackageRegistry|You are about to delete %{name}, this operation is irreversible, are you sure?',
|
||||
),
|
||||
modalAction: s__('PackageRegistry|Delete package'),
|
||||
deleteModalContent: s__('PackageRegistry|You are about to delete %{name}, are you sure?'),
|
||||
modalTitle: s__('PackageRegistry|Delete package'),
|
||||
modalAction: s__('PackageRegistry|Permanently delete'),
|
||||
errorMessageBodyAlert: s__(
|
||||
'PackageRegistry|There was a timeout and the package was not published. Delete this package and try again.',
|
||||
),
|
||||
|
@ -172,14 +171,14 @@ export default {
|
|||
|
||||
<gl-modal
|
||||
v-model="showDeleteModal"
|
||||
modal-id="confirm-delete-pacakge"
|
||||
modal-id="confirm-delete-package"
|
||||
size="sm"
|
||||
:action-primary="deleteModalActionPrimaryProps"
|
||||
:action-cancel="deleteModalActionCancelProps"
|
||||
@ok="deleteItemConfirmation"
|
||||
@cancel="deleteItemCanceled"
|
||||
>
|
||||
<template #modal-title>{{ $options.i18n.modalAction }}</template>
|
||||
<template #modal-title>{{ $options.i18n.modalTitle }}</template>
|
||||
<gl-sprintf :message="$options.i18n.deleteModalContent">
|
||||
<template #name>
|
||||
<strong>{{ deletePackageName }}</strong>
|
||||
|
|
|
@ -263,7 +263,7 @@ export default {
|
|||
},
|
||||
modal: {
|
||||
packageDeletePrimaryAction: {
|
||||
text: __('Delete'),
|
||||
text: s__('PackageRegistry|Permanently delete'),
|
||||
attributes: [
|
||||
{ variant: 'danger' },
|
||||
{ category: 'primary' },
|
||||
|
|
|
@ -27,11 +27,9 @@ class Projects::DeployKeysController < Projects::ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@key = DeployKeys::CreateService.new(current_user, create_params).execute(project: @project)
|
||||
@key = DeployKeys::CreateService.new(current_user, create_params).execute(project: @project).present
|
||||
|
||||
unless @key.valid?
|
||||
flash[:alert] = @key.errors.full_messages.join(', ').html_safe
|
||||
end
|
||||
flash[:alert] = @key.humanized_error_message unless @key.valid?
|
||||
|
||||
redirect_to_repository
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ class DeployKey < Key
|
|||
include FromUnion
|
||||
include IgnorableColumns
|
||||
include PolicyActor
|
||||
include Presentable
|
||||
|
||||
has_many :deploy_keys_projects, inverse_of: :deploy_key, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent
|
||||
has_many :projects, through: :deploy_keys_projects
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class DeployKeyPresenter < KeyPresenter # rubocop:disable Gitlab/NamespacedClass
|
||||
presents ::DeployKey, as: :deploy_key
|
||||
|
||||
def humanized_error_message
|
||||
super(type: :deploy_key)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class KeyPresenter < Gitlab::View::Presenter::Delegated # rubocop:disable Gitlab/NamespacedClass
|
||||
presents ::Key, as: :key_object
|
||||
|
||||
def humanized_error_message(type: :key)
|
||||
if !key_object.public_key.valid?
|
||||
help_link = help_page_link(_('supported SSH public key.'), 'user/ssh', 'supported-ssh-key-types')
|
||||
|
||||
_('%{type} must be a %{help_link}').html_safe % { type: type.to_s.titleize, help_link: help_link }
|
||||
else
|
||||
key_object.errors.full_messages.join(', ').html_safe
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def help_page_link(title, path, anchor)
|
||||
ActionController::Base.helpers.link_to(title, help_page_path(path, anchor: anchor),
|
||||
target: '_blank', rel: 'noopener noreferrer')
|
||||
end
|
||||
end
|
|
@ -19,7 +19,7 @@ module ObjectStorage
|
|||
|
||||
ip = IPAddr.new(request_ip)
|
||||
|
||||
return false if ip.private?
|
||||
return false if ip.private? || ip.link_local? || ip.loopback?
|
||||
|
||||
!GoogleIpCache.google_ip?(request_ip)
|
||||
end
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
name: group_analytics_dashboards_page
|
||||
introduced_by_url: 'https://gitlab.com/gitlab-org/gitlab/-/merge_requests/98767'
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/375251
|
||||
milestone: '15.5'
|
||||
type: development
|
||||
group: group::optimize
|
||||
default_enabled: false
|
|
@ -26,11 +26,6 @@ if log_deprecations?
|
|||
Gitlab::DeprecationJsonLogger.info(message: warning.strip, source: 'ruby')
|
||||
# Returning :default means we continue emitting this to stderr as well.
|
||||
:default
|
||||
end,
|
||||
# This won't be needed when https://gitlab.com/gitlab-org/gitlab/-/issues/340602 is completed
|
||||
/\A`Redis#exists\(key\)` will return an Integer in redis-rb 4\.3/ => lambda do |warning|
|
||||
Gitlab::DeprecationJsonLogger.info(message: warning.strip, source: 'redis')
|
||||
:default
|
||||
end
|
||||
}
|
||||
|
||||
|
|
|
@ -4,12 +4,6 @@ require 'gitlab/redis'
|
|||
|
||||
Redis.raise_deprecations = true unless Rails.env.production?
|
||||
|
||||
# We set the instance variable directly to suppress warnings.
|
||||
# We cannot switch to the new behavior until we change all existing `redis.exists` calls to `redis.exists?`.
|
||||
# Some gems also need to be updated
|
||||
# https://gitlab.com/gitlab-org/gitlab/-/issues/340602
|
||||
Redis.instance_variable_set(:@exists_returns_integer, nil)
|
||||
|
||||
Redis::Client.prepend(Gitlab::Instrumentation::RedisInterceptor)
|
||||
|
||||
# Make sure we initialize a Redis connection pool before multi-threaded
|
||||
|
|
|
@ -7,7 +7,7 @@ type: index, concepts, howto
|
|||
|
||||
# Development guide for GitLab CI/CD templates **(FREE)**
|
||||
|
||||
This document explains how to develop [GitLab CI/CD templates](../../ci/examples/index.md).
|
||||
This document explains how to develop [GitLab CI/CD templates](../../ci/examples/index.md#cicd-templates).
|
||||
|
||||
## Requirements for CI/CD templates
|
||||
|
||||
|
|
|
@ -13,11 +13,6 @@ To access the dashboard, on the top bar, select **Main menu > Operations**.
|
|||
|
||||
## Adding a project to the dashboard
|
||||
|
||||
NOTE:
|
||||
For GitLab.com, you can add your project to the Operations Dashboard for free if
|
||||
your project is public. If your project is private, the group it belongs to must
|
||||
have a [GitLab Premium](https://about.gitlab.com/pricing/) plan.
|
||||
|
||||
To add a project to the dashboard:
|
||||
|
||||
1. Ensure your alerts populate the `gitlab_environment_name` label on the alerts you set up in Prometheus.
|
||||
|
|
|
@ -1134,6 +1134,9 @@ msgstr ""
|
|||
msgid "%{total} warnings found: showing first %{warningsDisplayed}"
|
||||
msgstr ""
|
||||
|
||||
msgid "%{type} must be a %{help_link}"
|
||||
msgstr ""
|
||||
|
||||
msgid "%{type} only supports %{name} name"
|
||||
msgstr ""
|
||||
|
||||
|
@ -4513,6 +4516,9 @@ msgstr ""
|
|||
msgid "Analytics"
|
||||
msgstr ""
|
||||
|
||||
msgid "AnalyticsDashboards|Dashboards"
|
||||
msgstr ""
|
||||
|
||||
msgid "Analyze your dependencies for known vulnerabilities."
|
||||
msgstr ""
|
||||
|
||||
|
@ -28705,6 +28711,9 @@ msgstr[1] ""
|
|||
msgid "PackageRegistry|Package updated by commit %{link} on branch %{branch}, built by pipeline %{pipeline}, and published to the registry %{datetime}"
|
||||
msgstr ""
|
||||
|
||||
msgid "PackageRegistry|Permanently delete"
|
||||
msgstr ""
|
||||
|
||||
msgid "PackageRegistry|Permanently delete assets"
|
||||
msgstr ""
|
||||
|
||||
|
@ -28816,7 +28825,7 @@ msgstr ""
|
|||
msgid "PackageRegistry|You are about to delete %{filename}. This is a destructive action that may render your package unusable. Are you sure?"
|
||||
msgstr ""
|
||||
|
||||
msgid "PackageRegistry|You are about to delete %{name}, this operation is irreversible, are you sure?"
|
||||
msgid "PackageRegistry|You are about to delete %{name}, are you sure?"
|
||||
msgstr ""
|
||||
|
||||
msgid "PackageRegistry|You are about to delete 1 asset. This operation is irreversible."
|
||||
|
@ -48579,6 +48588,9 @@ msgstr ""
|
|||
msgid "suggestPipeline|We’re adding a GitLab CI configuration file to add a pipeline to the project. You could create it manually, but we recommend that you start with a GitLab template that works out of the box."
|
||||
msgstr ""
|
||||
|
||||
msgid "supported SSH public key."
|
||||
msgstr ""
|
||||
|
||||
msgid "tag name"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -72,13 +72,15 @@ RSpec.describe Projects::DeployKeysController do
|
|||
end
|
||||
|
||||
describe 'POST create' do
|
||||
let(:deploy_key_content) { attributes_for(:deploy_key)[:key] }
|
||||
|
||||
def create_params(title = 'my-key')
|
||||
{
|
||||
namespace_id: project.namespace.path,
|
||||
project_id: project.path,
|
||||
deploy_key: {
|
||||
title: title,
|
||||
key: attributes_for(:deploy_key)[:key],
|
||||
key: deploy_key_content,
|
||||
deploy_keys_projects_attributes: { '0' => { can_push: '1' } }
|
||||
}
|
||||
}
|
||||
|
@ -96,13 +98,38 @@ RSpec.describe Projects::DeployKeysController do
|
|||
expect(response).to redirect_to(project_settings_repository_path(project, anchor: 'js-deploy-keys-settings'))
|
||||
end
|
||||
|
||||
context 'when the deploy key is invalid' do
|
||||
context 'when the deploy key has an invalid title' do
|
||||
it 'shows an alert with the validations errors' do
|
||||
post :create, params: create_params(nil)
|
||||
|
||||
expect(flash[:alert]).to eq("Title can't be blank, Deploy keys projects deploy key title can't be blank")
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the deploy key is not supported SSH public key' do
|
||||
let(:deploy_key_content) { 'bogus ssh public key' }
|
||||
|
||||
it 'shows an alert with a help link' do
|
||||
post :create, params: create_params
|
||||
|
||||
expect(assigns(:key).errors.count).to be > 1
|
||||
expect(flash[:alert]).to eq('Deploy Key must be a <a target="_blank" rel="noopener noreferrer" ' \
|
||||
'href="/help/user/ssh#supported-ssh-key-types">supported SSH public key.</a>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the deploy key already exists' do
|
||||
before do
|
||||
create(:deploy_key, title: 'my-key', key: deploy_key_content, projects: [project])
|
||||
end
|
||||
|
||||
it 'shows an alert with the validations errors' do
|
||||
post :create, params: create_params
|
||||
|
||||
expect(flash[:alert]).to eq("Fingerprint sha256 has already been taken, " \
|
||||
"Deploy keys projects deploy key fingerprint sha256 has already been taken")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '/enable/:id' do
|
||||
|
|
|
@ -57,7 +57,7 @@ RSpec.describe 'Infrastructure Registry' do
|
|||
it 'allows you to delete a module', :aggregate_failures do
|
||||
# this is still using the package copy in the UI too
|
||||
click_button('Remove package')
|
||||
click_button('Delete package')
|
||||
click_button('Permanently delete')
|
||||
|
||||
expect(page).to have_content 'Package deleted successfully'
|
||||
expect(page).not_to have_content(terraform_module.name)
|
||||
|
|
|
@ -49,7 +49,7 @@ RSpec.describe 'Packages' do
|
|||
it 'allows you to delete a package' do
|
||||
find('[data-testid="delete-dropdown"]').click
|
||||
find('[data-testid="action-delete"]').click
|
||||
click_button('Delete package')
|
||||
click_button('Permanently delete')
|
||||
|
||||
expect(page).to have_content 'Package deleted successfully'
|
||||
expect(page).not_to have_content(package.name)
|
||||
|
|
|
@ -86,18 +86,6 @@ RSpec.describe '0_log_deprecations' do
|
|||
expect { warn('ABC gem is deprecated') }.to output.to_stderr
|
||||
end
|
||||
end
|
||||
|
||||
it 'logs Redis exists_returns_integer deprecation message' do
|
||||
msg = "`Redis#exists(key)` will return an Integer in redis-rb 4.3. `exists?` returns a boolean, you " \
|
||||
"should use it instead. To opt-in to the new behavior now you can set Redis.exists_returns_integer = " \
|
||||
"true. To disable this message and keep the current (boolean) behaviour of 'exists' you can set " \
|
||||
"`Redis.exists_returns_integer = false`, but this option will be removed in 5.0.0. " \
|
||||
"(#{::Kernel.caller(1, 1).first})\n"
|
||||
|
||||
expect(Gitlab::DeprecationJsonLogger).to receive(:info).with(message: msg.strip, source: 'redis')
|
||||
|
||||
expect { warn(msg) }.to output.to_stderr
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Rails deprecations' do
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe DeployKeyPresenter do
|
||||
let(:presenter) { described_class.new(deploy_key) }
|
||||
|
||||
describe '#humanized_error_message' do
|
||||
subject { presenter.humanized_error_message }
|
||||
|
||||
before do
|
||||
deploy_key.valid?
|
||||
end
|
||||
|
||||
context 'when public key is unsupported' do
|
||||
let(:deploy_key) { build(:deploy_key, key: 'a') }
|
||||
|
||||
it 'returns the custom error message' do
|
||||
expect(subject).to eq('Deploy Key must be a <a target="_blank" rel="noopener noreferrer" ' \
|
||||
'href="/help/user/ssh#supported-ssh-key-types">supported SSH public key.</a>')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,32 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe KeyPresenter do
|
||||
let(:presenter) { described_class.new(key) }
|
||||
|
||||
describe '#humanized_error_message' do
|
||||
subject { presenter.humanized_error_message }
|
||||
|
||||
before do
|
||||
key.valid?
|
||||
end
|
||||
|
||||
context 'when public key is unsupported' do
|
||||
let(:key) { build(:key, key: 'a') }
|
||||
|
||||
it 'returns the custom error message' do
|
||||
expect(subject).to eq('Key must be a <a target="_blank" rel="noopener noreferrer" ' \
|
||||
'href="/help/user/ssh#supported-ssh-key-types">supported SSH public key.</a>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when key is expired' do
|
||||
let(:key) { build(:key, :expired) }
|
||||
|
||||
it 'returns Active Record error message' do
|
||||
expect(subject).to eq('Key has expired')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -30,6 +30,8 @@ RSpec.describe ObjectStorage::CDN::GoogleCDN,
|
|||
'2600:1900:4180:0000:0000:0000:0000:0000' | false
|
||||
'10.10.1.5' | false
|
||||
'fc00:0000:0000:0000:0000:0000:0000:0000' | false
|
||||
'127.0.0.1' | false
|
||||
'169.254.0.0' | false
|
||||
end
|
||||
|
||||
with_them do
|
||||
|
|
Loading…
Reference in New Issue