Skip to content

Commit 213f46f

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 33f7ef8 commit 213f46f

File tree

301 files changed

+1376
-868
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

301 files changed

+1376
-868
lines changed

.gitlab-ci.yml

+13-12
Original file line numberDiff line numberDiff line change
@@ -126,22 +126,23 @@ variables:
126126
RUBY_VERSION: "2.7"
127127
GO_VERSION: "1.18"
128128

129-
TMP_TEST_FOLDER: "${CI_PROJECT_DIR}/tmp/tests"
130-
GITLAB_WORKHORSE_FOLDER: "gitlab-workhorse"
131-
TMP_TEST_GITLAB_WORKHORSE_PATH: "${TMP_TEST_FOLDER}/${GITLAB_WORKHORSE_FOLDER}"
132-
KNAPSACK_RSPEC_SUITE_REPORT_PATH: knapsack/report-master.json
133129
FLAKY_RSPEC_SUITE_REPORT_PATH: rspec/flaky/report-suite.json
134-
RSPEC_TESTS_MAPPING_PATH: crystalball/mapping.json
135-
RSPEC_PACKED_TESTS_MAPPING_PATH: crystalball/packed-mapping.json
136-
RSPEC_PROFILING_FOLDER_PATH: rspec/profiling
137130
FRONTEND_FIXTURES_MAPPING_PATH: crystalball/frontend_fixtures_mapping.json
138-
RSPEC_CHANGED_FILES_PATH: rspec/changed_files.txt
139-
RSPEC_MATCHING_TESTS_PATH: rspec/matching_tests.txt
140-
RSPEC_MATCHING_TESTS_FOSS_PATH: rspec/matching_tests-foss.txt
141-
RSPEC_LAST_RUN_RESULTS_FILE: rspec/rspec_last_run_results.txt
142-
RSPEC_FOSS_IMPACT_PIPELINE_YML: rspec-foss-impact-pipeline.yml
131+
GITLAB_WORKHORSE_FOLDER: "gitlab-workhorse"
143132
JUNIT_RESULT_FILE: rspec/junit_rspec.xml
144133
JUNIT_RETRY_FILE: rspec/junit_rspec-retry.xml
134+
KNAPSACK_RSPEC_SUITE_REPORT_PATH: knapsack/report-master.json
135+
RSPEC_CHANGED_FILES_PATH: rspec/changed_files.txt
136+
RSPEC_FOSS_IMPACT_PIPELINE_YML: rspec-foss-impact-pipeline.yml
137+
RSPEC_LAST_RUN_RESULTS_FILE: rspec/rspec_last_run_results.txt
138+
RSPEC_MATCHING_JS_FILES_PATH: rspec/js_matching_files.txt
139+
RSPEC_MATCHING_TESTS_FOSS_PATH: rspec/matching_tests-foss.txt
140+
RSPEC_MATCHING_TESTS_PATH: rspec/matching_tests.txt
141+
RSPEC_PACKED_TESTS_MAPPING_PATH: crystalball/packed-mapping.json
142+
RSPEC_PROFILING_FOLDER_PATH: rspec/profiling
143+
RSPEC_TESTS_MAPPING_PATH: crystalball/mapping.json
144+
TMP_TEST_FOLDER: "${CI_PROJECT_DIR}/tmp/tests"
145+
TMP_TEST_GITLAB_WORKHORSE_PATH: "${TMP_TEST_FOLDER}/${GITLAB_WORKHORSE_FOLDER}"
145146

146147
ES_JAVA_OPTS: "-Xms256m -Xmx256m"
147148
ELASTIC_URL: "http://elastic:changeme@elasticsearch:9200"

.gitlab/CODEOWNERS

-1
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,6 @@ lib/gitlab/checks/** @proglottis @toon @zj-gitlab
14381438
/**/javascripts/jobs/ @gitlab-org/ci-cd/verify/frontend
14391439
/**/javascripts/pipelines/ @gitlab-org/ci-cd/verify/frontend
14401440
/app/assets/javascripts/ci/ @gitlab-org/ci-cd/verify/frontend
1441-
/app/assets/javascripts/pipeline_new/ @gitlab-org/ci-cd/verify/frontend
14421441
/app/assets/javascripts/ci/pipeline_schedules/ @gitlab-org/ci-cd/verify/frontend
14431442
/ee/app/assets/javascripts/ci/ @gitlab-org/ci-cd/verify/frontend
14441443
/app/assets/javascripts/token_access/ @gitlab-org/ci-cd/verify/frontend

.gitlab/ci/frontend.gitlab-ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ jest minimal:
212212
- !reference [jest, needs]
213213
- "detect-tests"
214214
script:
215-
- if [[ -s "$RSPEC_CHANGED_FILES_PATH" ]]; then run_timed_command "yarn jest:ci:minimal"; fi
215+
- if [[ -s "$RSPEC_CHANGED_FILES_PATH" ]] || [[ -s "$RSPEC_MATCHING_JS_FILES_PATH" ]]; then run_timed_command "yarn jest:ci:minimal"; fi
216216

217217
jest as-if-foss:
218218
extends:
@@ -231,7 +231,7 @@ jest minimal as-if-foss:
231231
- "rspec-all frontend_fixture as-if-foss"
232232
- "detect-tests"
233233
script:
234-
- if [[ -s "$RSPEC_CHANGED_FILES_PATH" ]]; then run_timed_command "yarn jest:ci:minimal"; fi
234+
- if [[ -s "$RSPEC_CHANGED_FILES_PATH" ]] || [[ -s "$RSPEC_MATCHING_JS_FILES_PATH" ]]; then run_timed_command "yarn jest:ci:minimal"; fi
235235

236236
jest-integration:
237237
extends:

.gitlab/ci/setup.gitlab-ci.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,20 @@ detect-tests:
137137
tooling/bin/find_tests ${RSPEC_CHANGED_FILES_PATH} ${RSPEC_MATCHING_TESTS_PATH};
138138
tooling/bin/find_changes ${RSPEC_CHANGED_FILES_PATH} ${RSPEC_MATCHING_TESTS_PATH} ${FRONTEND_FIXTURES_MAPPING_PATH};
139139
filter_rspec_matched_foss_tests ${RSPEC_MATCHING_TESTS_PATH} ${RSPEC_MATCHING_TESTS_FOSS_PATH};
140+
tooling/bin/view_to_js_mappings ${RSPEC_CHANGED_FILES_PATH} ${RSPEC_MATCHING_JS_FILES_PATH};
140141
echoinfo "Changed files: $(cat $RSPEC_CHANGED_FILES_PATH)";
141142
echoinfo "Related RSpec tests: $(cat $RSPEC_MATCHING_TESTS_PATH)";
142143
echoinfo "Related FOSS RSpec tests: $(cat $RSPEC_MATCHING_TESTS_FOSS_PATH)";
144+
echoinfo "Related JS files: $(cat $RSPEC_MATCHING_JS_FILES_PATH)";
143145
fi
144146
artifacts:
145147
expire_in: 7d
146148
paths:
149+
- ${FRONTEND_FIXTURES_MAPPING_PATH}
147150
- ${RSPEC_CHANGED_FILES_PATH}
148-
- ${RSPEC_MATCHING_TESTS_PATH}
151+
- ${RSPEC_MATCHING_JS_FILES_PATH}
149152
- ${RSPEC_MATCHING_TESTS_FOSS_PATH}
150-
- ${FRONTEND_FIXTURES_MAPPING_PATH}
153+
- ${RSPEC_MATCHING_TESTS_PATH}
151154

152155
detect-previous-failed-tests:
153156
extends:

.rubocop_todo/layout/line_length.yml

-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ Layout/LineLength:
4343
- 'app/controllers/groups/settings/integrations_controller.rb'
4444
- 'app/controllers/groups/settings/repository_controller.rb'
4545
- 'app/controllers/groups_controller.rb'
46-
- 'app/controllers/import/available_namespaces_controller.rb'
4746
- 'app/controllers/import/base_controller.rb'
4847
- 'app/controllers/import/bitbucket_controller.rb'
4948
- 'app/controllers/import/bitbucket_server_controller.rb'
@@ -3672,7 +3671,6 @@ Layout/LineLength:
36723671
- 'spec/controllers/groups/settings/applications_controller_spec.rb'
36733672
- 'spec/controllers/groups/settings/integrations_controller_spec.rb'
36743673
- 'spec/controllers/groups_controller_spec.rb'
3675-
- 'spec/controllers/import/available_namespaces_controller_spec.rb'
36763674
- 'spec/controllers/import/bitbucket_controller_spec.rb'
36773675
- 'spec/controllers/import/bitbucket_server_controller_spec.rb'
36783676
- 'spec/controllers/import/bulk_imports_controller_spec.rb'

.rubocop_todo/performance/string_identifier_argument.yml

-39
This file was deleted.

.rubocop_todo/style/class_and_module_children.yml

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ Style/ClassAndModuleChildren:
7878
- 'app/controllers/groups/milestones_controller.rb'
7979
- 'app/controllers/groups/runners_controller.rb'
8080
- 'app/controllers/groups/uploads_controller.rb'
81-
- 'app/controllers/import/available_namespaces_controller.rb'
8281
- 'app/controllers/import/base_controller.rb'
8382
- 'app/controllers/import/bitbucket_controller.rb'
8483
- 'app/controllers/import/bitbucket_server_controller.rb'

app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules_form.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default {
7171
timezone: this.cronTimezone,
7272
formCiVariables: {},
7373
// TODO: Add the GraphQL query to help populate the predefined variables
74-
// app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue#131
74+
// app/assets/javascripts/ci/pipeline_new/components/pipeline_new_form.vue#131
7575
predefinedValueOptions: {},
7676
};
7777
},
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
import initNewPipelineForm from '~/pipeline_new/index';
1+
import initNewPipelineForm from '~/ci/pipeline_new/index';
22

33
initNewPipelineForm();

app/controllers/groups_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def authorize_create_group!
256256

257257
def determine_layout
258258
if [:new, :create].include?(action_name.to_sym)
259-
'application'
259+
'dashboard'
260260
elsif [:edit, :update, :projects].include?(action_name.to_sym)
261261
'group_settings'
262262
else

app/controllers/import/available_namespaces_controller.rb

-10
This file was deleted.

app/controllers/projects/environments_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def authorize_update_environment!
303303
def append_info_to_payload(payload)
304304
super
305305

306-
return unless Feature.enabled?(:environments_search_logging) && params[:search]
306+
return unless Feature.enabled?(:environments_search_logging) && params[:search].present?
307307

308308
# Merging to :metadata will ensure these are logged as top level keys
309309
payload[:metadata] ||= {}

app/helpers/groups/observability_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module ObservabilityHelper
1313
},
1414
'explore' => {
1515
path: '/explore',
16-
title: -> { s_('Observability|Explore') }
16+
title: -> { s_('Observability|Explore telemetry data') }
1717
},
1818
'datasources' => {
1919
path: '/datasources',

app/mailers/emails/imports.rb

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
module Emails
4+
module Imports
5+
def github_gists_import_errors_email(user_id, errors)
6+
@errors = errors
7+
user = User.find(user_id)
8+
9+
email_with_layout(
10+
to: user.notification_email_or_default,
11+
subject: subject(s_('GithubImporter|GitHub Gists import finished with errors'))
12+
)
13+
end
14+
end
15+
end

app/mailers/notify.rb

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class Notify < ApplicationMailer
2424
include Emails::InProductMarketing
2525
include Emails::AdminNotification
2626
include Emails::IdentityVerification
27+
include Emails::Imports
2728

2829
helper TimeboxesHelper
2930
helper MergeRequestsHelper

app/mailers/previews/notify_preview.rb

+4
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ def project_was_moved_email
225225
Notify.project_was_moved_email(project.id, user.id, "gitlab/gitlab").message
226226
end
227227

228+
def github_gists_import_errors_email
229+
Notify.github_gists_import_errors_email(user.id, { '12345' => 'Snippet maximum file count exceeded', '67890' => 'error message 2' }).message
230+
end
231+
228232
private
229233

230234
def project

app/models/abuse_report.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class AbuseReport < ApplicationRecord
1515
validates :category, presence: true
1616
validates :user_id,
1717
uniqueness: {
18-
scope: :reporter_id,
18+
scope: [:reporter_id, :category],
1919
message: ->(object, data) do
20-
_('has already been reported for abuse')
20+
_('You have already reported this user')
2121
end
2222
}
2323

app/services/security/ci_configuration/base_create_service.rb

+21-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module Security
44
module CiConfiguration
55
class BaseCreateService
6-
attr_reader :branch_name, :current_user, :project
6+
attr_reader :branch_name, :current_user, :project, :name
77

88
def initialize(project, current_user)
99
@project = project
@@ -41,8 +41,18 @@ def attributes
4141
end
4242

4343
def existing_gitlab_ci_content
44-
@gitlab_ci_yml ||= project.ci_config_for(project.repository.root_ref_sha)
44+
root_ref = root_ref_sha(project)
45+
return if root_ref.nil?
46+
47+
@gitlab_ci_yml ||= project.ci_config_for(root_ref)
4548
YAML.safe_load(@gitlab_ci_yml) if @gitlab_ci_yml
49+
rescue Psych::BadAlias
50+
raise Gitlab::Graphql::Errors::MutationError,
51+
".gitlab-ci.yml with aliases/anchors is not supported. Please change the CI configuration manually."
52+
rescue Psych::Exception => e
53+
Gitlab::AppLogger.error("Failed to process existing .gitlab-ci.yml: #{e.message}")
54+
raise Gitlab::Graphql::Errors::MutationError,
55+
"#{name} merge request creation mutation failed"
4656
end
4757

4858
def successful_change_path
@@ -61,6 +71,15 @@ def track_event(attributes_for_commit)
6171
self.class.to_s, action[:action], label: action[:default_values_overwritten].to_s
6272
)
6373
end
74+
75+
def root_ref_sha(project)
76+
project.repository.root_ref_sha
77+
rescue StandardError => e
78+
# this might fail on the very first commit,
79+
# and unfortunately it raises a StandardError
80+
Gitlab::ErrorTracking.track_exception(e, project_id: project.id)
81+
nil
82+
end
6483
end
6584
end
6685
end

app/services/security/ci_configuration/container_scanning_create_service.rb

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ def message
2121
def description
2222
_('Configure Container Scanning in `.gitlab-ci.yml` using the GitLab managed template. You can [add variable overrides](https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings) to customize Container Scanning settings.')
2323
end
24+
25+
def name
26+
'Container Scanning'
27+
end
2428
end
2529
end
2630
end

app/services/security/ci_configuration/dependency_scanning_create_service.rb

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ def message
2121
def description
2222
_('Configure Dependency Scanning in `.gitlab-ci.yml` using the GitLab managed template. You can [add variable overrides](https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings) to customize Dependency Scanning settings.')
2323
end
24+
25+
def name
26+
'Dependency Scanning'
27+
end
2428
end
2529
end
2630
end

app/services/security/ci_configuration/sast_create_service.rb

+5-7
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,7 @@ def remove_branch_on_exception
2020
end
2121

2222
def action
23-
existing_content = begin
24-
existing_gitlab_ci_content # this can fail on the very first commit
25-
rescue StandardError
26-
nil
27-
end
28-
29-
Security::CiConfiguration::SastBuildAction.new(project.auto_devops_enabled?, params, existing_content, project.ci_config_path).generate
23+
Security::CiConfiguration::SastBuildAction.new(project.auto_devops_enabled?, params, existing_gitlab_ci_content, project.ci_config_path).generate
3024
end
3125

3226
def next_branch
@@ -40,6 +34,10 @@ def message
4034
def description
4135
_('Configure SAST in `.gitlab-ci.yml` using the GitLab managed template. You can [add variable overrides](https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings) to customize SAST settings.')
4236
end
37+
38+
def name
39+
'SAST'
40+
end
4341
end
4442
end
4543
end

app/services/security/ci_configuration/sast_iac_create_service.rb

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ def message
2121
def description
2222
_('Configure SAST IaC in `.gitlab-ci.yml` using the GitLab managed template. You can [add variable overrides](https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings) to customize SAST IaC settings.')
2323
end
24+
25+
def name
26+
'SAST IaC'
27+
end
2428
end
2529
end
2630
end

app/services/security/ci_configuration/secret_detection_create_service.rb

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ def message
2121
def description
2222
_('Configure Secret Detection in `.gitlab-ci.yml` using the GitLab managed template. You can [add variable overrides](https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings) to customize Secret Detection settings.')
2323
end
24+
25+
def name
26+
'Secret Detection'
27+
end
2428
end
2529
end
2630
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
- text_style = 'font-size:16px; text-align:center; line-height:30px;'
2+
3+
%p{ style: text_style }
4+
= s_('GithubImporter|Your import of GitHub gists into GitLab snippets is complete.')
5+
6+
%p
7+
= s_('GithubImporter|GitHub gists that were not imported:')
8+
9+
%ol
10+
- @errors.each do |gist_id, error|
11+
%li
12+
= s_("GithubImporter|Gist with id %{gist_id} failed due to error: %{error}.") % { gist_id: gist_id, error: error }
13+
- if error == Gitlab::GithubGistsImport::Importer::GistImporter::FILE_COUNT_LIMIT_MESSAGE
14+
- import_snippets_url = help_page_url('api/import.md', anchor: 'import-github-gists-into-gitlab-snippets')
15+
- import_snippets_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: import_snippets_url }
16+
= html_escape(s_("GithubImporter|Please follow %{import_snippets_link_start}Import GitHub gists into GitLab snippets%{import_snippets_link_end} for more details.")) % { import_snippets_link_start: import_snippets_link_start, import_snippets_link_end: '</a>'.html_safe }
17+
18+
%p
19+
= s_('GithubImporter|GitHub gists with more than 10 files must be manually migrated.')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<%= s_('GithubImporter|Your import of GitHub gists into GitLab snippets is complete.') %>
2+
3+
<%= s_('GithubImporter|GitHub gists that were not imported:') %>
4+
<% @errors.each do |gist_id, error| %>
5+
- <%= s_("GithubImporter|Gist with id %{gist_id} failed due to error: %{error}.") % { gist_id: gist_id, error: error } %>
6+
<% if error == Gitlab::GithubGistsImport::Importer::GistImporter::FILE_COUNT_LIMIT_MESSAGE %>
7+
<% import_snippets_url = help_page_url('api/import.md', anchor: 'import-github-gists-into-gitlab-snippets') %>
8+
<%= s_("GithubImporter|Please follow %{import_snippets_url} for more details.") % { import_snippets_url: import_snippets_url } %>
9+
<% end %>
10+
<% end %>
11+
12+
<%= s_('GithubImporter|GitHub gists with more than 10 files must be manually migrated.') %>

0 commit comments

Comments
 (0)