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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-13 15:09:50 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-13 15:09:50 +0300
commit0c762fd1b77efe62beb37f9617100724bb2ed2f9 (patch)
tree0c7af20a278036fce7e86b1f1e9a5e0d3ae3ab5f
parent12221d835d5f63c4747f0cbd30e4aac8b78e857c (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/states/nothing_to_merge.vue8
-rw-r--r--app/models/concerns/has_repository.rb4
-rw-r--r--app/models/project.rb5
-rw-r--r--app/models/repository.rb5
-rw-r--r--app/views/sherlock/queries/_backtrace.html.haml2
-rw-r--r--app/views/sherlock/queries/_general.html.haml2
-rw-r--r--doc/update/index.md2
-rw-r--r--doc/user/application_security/coverage_fuzzing/index.md8
-rw-r--r--doc/user/application_security/policies/index.md2
-rw-r--r--qa/qa/page/merge_request/show.rb8
-rw-r--r--scripts/rspec_helpers.sh4
-rw-r--r--spec/models/project_spec.rb10
-rw-r--r--spec/models/repository_spec.rb58
13 files changed, 84 insertions, 34 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/nothing_to_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/nothing_to_merge.vue
index 0f81326d052..7827c79cd31 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/states/nothing_to_merge.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/states/nothing_to_merge.vue
@@ -1,5 +1,5 @@
<script>
-import { GlButton, GlSprintf, GlLink } from '@gitlab/ui';
+import { GlButton, GlSprintf, GlLink, GlSafeHtmlDirective } from '@gitlab/ui';
import emptyStateSVG from 'icons/_mr_widget_empty_state.svg';
import { helpPagePath } from '~/helpers/help_page_helper';
@@ -10,6 +10,9 @@ export default {
GlSprintf,
GlLink,
},
+ directives: {
+ SafeHtml: GlSafeHtmlDirective,
+ },
props: {
mr: {
type: Object,
@@ -20,6 +23,7 @@ export default {
return { emptyStateSVG };
},
ciHelpPage: helpPagePath('/ci/quick_start/index.html'),
+ safeHtmlConfig: { ADD_TAGS: ['use'] },
};
</script>
@@ -29,7 +33,7 @@ export default {
<div
class="artwork col-md-5 order-md-last col-12 text-center d-flex justify-content-center align-items-center"
>
- <span v-html="emptyStateSVG /* eslint-disable-line vue/no-v-html */"></span>
+ <span v-safe-html:[$options.safeHtmlConfig]="emptyStateSVG"></span>
</div>
<div class="text col-md-7 order-md-first col-12">
<p class="highlight">
diff --git a/app/models/concerns/has_repository.rb b/app/models/concerns/has_repository.rb
index 1b4c590694a..9218ba47d20 100644
--- a/app/models/concerns/has_repository.rb
+++ b/app/models/concerns/has_repository.rb
@@ -122,4 +122,8 @@ module HasRepository
def after_repository_change_head
reload_default_branch
end
+
+ def after_change_head_branch_does_not_exist(branch)
+ # No-op (by default)
+ end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index c594adaae45..fc2bf70f8df 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -2739,6 +2739,11 @@ class Project < ApplicationRecord
self.topics.map(&:name)
end
+ override :after_change_head_branch_does_not_exist
+ def after_change_head_branch_does_not_exist(branch)
+ self.errors.add(:base, _("Could not change HEAD: branch '%{branch}' does not exist") % { branch: branch })
+ end
+
private
def save_topics
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 5c5ea8af22b..33225e51abc 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -1123,10 +1123,7 @@ class Repository
copy_gitattributes(branch)
after_change_head
else
- # For example, `Wiki` does not have `errors` because it is not an `ActiveModel`
- if container.respond_to?(:errors)
- container.errors.add(:base, _("Could not change HEAD: branch '%{branch}' does not exist") % { branch: branch })
- end
+ container.after_change_head_branch_does_not_exist(branch)
false
end
diff --git a/app/views/sherlock/queries/_backtrace.html.haml b/app/views/sherlock/queries/_backtrace.html.haml
index ff5a6b73e47..425113ba325 100644
--- a/app/views/sherlock/queries/_backtrace.html.haml
+++ b/app/views/sherlock/queries/_backtrace.html.haml
@@ -8,7 +8,7 @@
%li
%strong
- if defined?(BetterErrors)
- = link_to(location.path, BetterErrors.editor[location.path, location.line])
+ = link_to(location.path, BetterErrors.editor.url(location.path, location.line))
- else
= location.path
%small.light
diff --git a/app/views/sherlock/queries/_general.html.haml b/app/views/sherlock/queries/_general.html.haml
index cd810ae10ad..a16314213c4 100644
--- a/app/views/sherlock/queries/_general.html.haml
+++ b/app/views/sherlock/queries/_general.html.haml
@@ -16,7 +16,7 @@
#{t('sherlock.origin')}:
%strong
- if defined?(BetterErrors)
- = link_to(frame.path, BetterErrors.editor[frame.path, frame.line])
+ = link_to(frame.path, BetterErrors.editor.url(frame.path, frame.line))
- else
= frame.path
%small.light
diff --git a/doc/update/index.md b/doc/update/index.md
index a933b347449..0009b5d1ec6 100644
--- a/doc/update/index.md
+++ b/doc/update/index.md
@@ -186,7 +186,7 @@ Find where your version sits in the upgrade path below, and upgrade GitLab
accordingly, while also consulting the
[version-specific upgrade instructions](#version-specific-upgrading-instructions):
-`8.11.Z` -> [`8.12.0`](#upgrades-from-versions-earlier-than-812) -> `8.17.7` -> `9.5.10` -> `10.8.7` -> [`11.11.8`](#1200) -> `12.0.12` -> [`12.1.17`](#1210) -> `12.10.14` -> `13.0.14` -> [`13.1.11`](#1310) -> [`13.8.8`](#1388) -> [latest `13.12.Z`](https://about.gitlab.com/releases/categories/releases/) -> [latest `14.0.Z`](#1400) -> [`14.1.Z`](#1410) -> [latest `14.Y.Z`](https://about.gitlab.com/releases/categories/releases/)
+`8.11.Z` -> [`8.12.0`](#upgrades-from-versions-earlier-than-812) -> `8.17.7` -> `9.5.10` -> `10.8.7` -> [`11.11.8`](#1200) -> `12.0.12` -> [`12.1.17`](#1210) -> `12.10.14` -> `13.0.14` -> [`13.1.11`](#1310) -> [`13.8.8`](#1388) -> [latest `13.12.Z`](https://about.gitlab.com/releases/categories/releases/) -> [latest `14.0.Z`](#1400) -> [latest `14.Y.Z`](https://about.gitlab.com/releases/categories/releases/)
The following table, while not exhaustive, shows some examples of the supported
upgrade paths.
diff --git a/doc/user/application_security/coverage_fuzzing/index.md b/doc/user/application_security/coverage_fuzzing/index.md
index 679d20a6394..2048cc48000 100644
--- a/doc/user/application_security/coverage_fuzzing/index.md
+++ b/doc/user/application_security/coverage_fuzzing/index.md
@@ -5,7 +5,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
type: reference, howto
---
-# Coverage Guided Fuzz Testing **(ULTIMATE)**
+# Coverage-guided fuzz testing **(ULTIMATE)**
GitLab allows you to add coverage-guided fuzz testing to your pipelines. This helps you discover
bugs and potential security issues that other QA processes may miss. Coverage-guided fuzzing sends
@@ -97,7 +97,7 @@ Each fuzzing step outputs these artifacts:
- `crashes`: Holds all crash events the current job encountered as well as those not fixed in
previous jobs.
-### Types of Fuzzing Jobs
+### Types of fuzzing jobs
There are two types of jobs:
@@ -172,13 +172,13 @@ Here's an example coverage fuzzing report:
}
```
-### Additional Configuration
+### Additional configuration
The `gitlab-cov-fuzz` command passes all arguments it receives to the underlying fuzzing engine. You
can therefore use all the options available in that fuzzing engine. For more information on these
options, see the underlying fuzzing engine's documentation.
-### Offline Environment
+### Offline environment
To use coverage fuzzing in an offline environment, follow these steps:
diff --git a/doc/user/application_security/policies/index.md b/doc/user/application_security/policies/index.md
index 47d015a78e3..ba863e8e744 100644
--- a/doc/user/application_security/policies/index.md
+++ b/doc/user/application_security/policies/index.md
@@ -12,7 +12,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
FLAG:
On self-managed GitLab, by default this feature is available. To hide the feature,
ask an administrator to [disable the `security_orchestration_policies_configuration` flag](../../../administration/feature_flags.md).
-On GitLab.com, this feature is not available.
+On GitLab.com, this feature is available.
Policies in GitLab provide security teams a way to require scans of their choice to be run
whenever a project pipeline runs according to the configuration specified. Security teams can
diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb
index baf9d774bda..1d8d9ed6859 100644
--- a/qa/qa/page/merge_request/show.rb
+++ b/qa/qa/page/merge_request/show.rb
@@ -136,14 +136,14 @@ module QA
end
def submit_pending_reviews
+ has_element?(:submit_review_button)
within_element(:review_bar_content) do
click_element(:review_preview_dropdown)
click_element(:submit_review_button)
-
- # After clicking the button, wait for it to disappear
- # before moving on to the next part of the test
- has_no_element?(:submit_review_button)
end
+ # After clicking the button, wait for it to disappear
+ # before moving on to the next part of the test
+ has_no_element?(:submit_review_button)
end
def add_comment_to_diff(text)
diff --git a/scripts/rspec_helpers.sh b/scripts/rspec_helpers.sh
index 797d9188f81..f3e00ce3d1c 100644
--- a/scripts/rspec_helpers.sh
+++ b/scripts/rspec_helpers.sh
@@ -63,7 +63,9 @@ function retrieve_tests_mapping() {
local artifact_branch="master"
local test_metadata_with_mapping_job_id
- test_metadata_with_mapping_job_id=$(scripts/api/get_job_id.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" -q "status=success" -q "ref=${artifact_branch}" -q "username=gitlab-bot" -Q "scope=success" --job-name "update-tests-metadata" --artifact-path "${RSPEC_PACKED_TESTS_MAPPING_PATH}.gz")
+ # FIXME: retrieving job id is failing https://gitlab.com/gitlab-org/gitlab/-/issues/340706
+ # test_metadata_with_mapping_job_id=$(scripts/api/get_job_id.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" -q "status=success" -q "ref=${artifact_branch}" -q "username=gitlab-bot" -Q "scope=success" --job-name "update-tests-metadata" --artifact-path "${RSPEC_PACKED_TESTS_MAPPING_PATH}.gz")
+ test_metadata_with_mapping_job_id="1583877936"
if [[ ! -f "${RSPEC_PACKED_TESTS_MAPPING_PATH}" ]]; then
(scripts/api/download_job_artifact.rb --endpoint "https://gitlab.com/api/v4" --project "${project_path}" --job-id "${test_metadata_with_mapping_job_id}" --artifact-path "${RSPEC_PACKED_TESTS_MAPPING_PATH}.gz" && gzip -d "${RSPEC_PACKED_TESTS_MAPPING_PATH}.gz") || echo "{}" > "${RSPEC_PACKED_TESTS_MAPPING_PATH}"
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 438d47e56a9..0b76dc3f87f 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -3310,6 +3310,16 @@ RSpec.describe Project, factory_default: :keep do
end
end
+ describe '#after_change_head_branch_does_not_exist' do
+ let_it_be(:project) { create(:project) }
+
+ it 'adds an error to container if branch does not exist' do
+ expect do
+ project.after_change_head_branch_does_not_exist('unexisted-branch')
+ end.to change { project.errors.size }.from(0).to(1)
+ end
+ end
+
describe '#lfs_objects_for_repository_types' do
let(:project) { create(:project) }
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index 6d50c55b011..047e1ac93e2 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -3283,26 +3283,54 @@ RSpec.describe Repository do
describe '#change_head' do
let(:branch) { repository.container.default_branch }
- it 'adds an error to container if branch does not exist' do
- expect(repository.change_head('unexisted-branch')).to be false
- expect(repository.container.errors.size).to eq(1)
- end
+ context 'when the branch exists' do
+ it 'returns truthy' do
+ expect(repository.change_head(branch)).to be_truthy
+ end
- it 'calls the before_change_head and after_change_head methods' do
- expect(repository).to receive(:before_change_head)
- expect(repository).to receive(:after_change_head)
+ it 'does not call container.after_change_head_branch_does_not_exist' do
+ expect(repository.container).not_to receive(:after_change_head_branch_does_not_exist)
- repository.change_head(branch)
- end
+ repository.change_head(branch)
+ end
+
+ it 'calls repository hooks' do
+ expect(repository).to receive(:before_change_head)
+ expect(repository).to receive(:after_change_head)
+
+ repository.change_head(branch)
+ end
+
+ it 'copies the gitattributes' do
+ expect(repository).to receive(:copy_gitattributes).with(branch)
+ repository.change_head(branch)
+ end
- it 'copies the gitattributes' do
- expect(repository).to receive(:copy_gitattributes).with(branch)
- repository.change_head(branch)
+ it 'reloads the default branch' do
+ expect(repository.container).to receive(:reload_default_branch)
+ repository.change_head(branch)
+ end
end
- it 'reloads the default branch' do
- expect(repository.container).to receive(:reload_default_branch)
- repository.change_head(branch)
+ context 'when the branch does not exist' do
+ let(:branch) { 'non-existent-branch' }
+
+ it 'returns falsey' do
+ expect(repository.change_head(branch)).to be_falsey
+ end
+
+ it 'calls container.after_change_head_branch_does_not_exist' do
+ expect(repository.container).to receive(:after_change_head_branch_does_not_exist).with(branch)
+
+ repository.change_head(branch)
+ end
+
+ it 'does not call repository hooks' do
+ expect(repository).not_to receive(:before_change_head)
+ expect(repository).not_to receive(:after_change_head)
+
+ repository.change_head(branch)
+ end
end
end
end