Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
		
							parent
							
								
									12221d835d
								
							
						
					
					
						commit
						0c762fd1b7
					
				|  | @ -1,5 +1,5 @@ | ||||||
| <script> | <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 emptyStateSVG from 'icons/_mr_widget_empty_state.svg'; | ||||||
| import { helpPagePath } from '~/helpers/help_page_helper'; | import { helpPagePath } from '~/helpers/help_page_helper'; | ||||||
| 
 | 
 | ||||||
|  | @ -10,6 +10,9 @@ export default { | ||||||
|     GlSprintf, |     GlSprintf, | ||||||
|     GlLink, |     GlLink, | ||||||
|   }, |   }, | ||||||
|  |   directives: { | ||||||
|  |     SafeHtml: GlSafeHtmlDirective, | ||||||
|  |   }, | ||||||
|   props: { |   props: { | ||||||
|     mr: { |     mr: { | ||||||
|       type: Object, |       type: Object, | ||||||
|  | @ -20,6 +23,7 @@ export default { | ||||||
|     return { emptyStateSVG }; |     return { emptyStateSVG }; | ||||||
|   }, |   }, | ||||||
|   ciHelpPage: helpPagePath('/ci/quick_start/index.html'), |   ciHelpPage: helpPagePath('/ci/quick_start/index.html'), | ||||||
|  |   safeHtmlConfig: { ADD_TAGS: ['use'] }, | ||||||
| }; | }; | ||||||
| </script> | </script> | ||||||
| 
 | 
 | ||||||
|  | @ -29,7 +33,7 @@ export default { | ||||||
|       <div |       <div | ||||||
|         class="artwork col-md-5 order-md-last col-12 text-center d-flex justify-content-center align-items-center" |         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> | ||||||
|       <div class="text col-md-7 order-md-first col-12"> |       <div class="text col-md-7 order-md-first col-12"> | ||||||
|         <p class="highlight"> |         <p class="highlight"> | ||||||
|  |  | ||||||
|  | @ -122,4 +122,8 @@ module HasRepository | ||||||
|   def after_repository_change_head |   def after_repository_change_head | ||||||
|     reload_default_branch |     reload_default_branch | ||||||
|   end |   end | ||||||
|  | 
 | ||||||
|  |   def after_change_head_branch_does_not_exist(branch) | ||||||
|  |     # No-op (by default) | ||||||
|  |   end | ||||||
| end | end | ||||||
|  |  | ||||||
|  | @ -2739,6 +2739,11 @@ class Project < ApplicationRecord | ||||||
|     self.topics.map(&:name) |     self.topics.map(&:name) | ||||||
|   end |   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 |   private | ||||||
| 
 | 
 | ||||||
|   def save_topics |   def save_topics | ||||||
|  |  | ||||||
|  | @ -1123,10 +1123,7 @@ class Repository | ||||||
|       copy_gitattributes(branch) |       copy_gitattributes(branch) | ||||||
|       after_change_head |       after_change_head | ||||||
|     else |     else | ||||||
|       # For example, `Wiki` does not have `errors` because it is not an `ActiveModel` |       container.after_change_head_branch_does_not_exist(branch) | ||||||
|       if container.respond_to?(:errors) |  | ||||||
|         container.errors.add(:base, _("Could not change HEAD: branch '%{branch}' does not exist") % { branch: branch }) |  | ||||||
|       end |  | ||||||
| 
 | 
 | ||||||
|       false |       false | ||||||
|     end |     end | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ | ||||||
|         %li |         %li | ||||||
|           %strong |           %strong | ||||||
|             - if defined?(BetterErrors) |             - 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 |             - else | ||||||
|               = location.path |               = location.path | ||||||
|           %small.light |           %small.light | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ | ||||||
|           #{t('sherlock.origin')}: |           #{t('sherlock.origin')}: | ||||||
|         %strong |         %strong | ||||||
|           - if defined?(BetterErrors) |           - 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 |           - else | ||||||
|             = frame.path |             = frame.path | ||||||
|         %small.light |         %small.light | ||||||
|  |  | ||||||
|  | @ -186,7 +186,7 @@ Find where your version sits in the upgrade path below, and upgrade GitLab | ||||||
| accordingly, while also consulting the | accordingly, while also consulting the | ||||||
| [version-specific upgrade instructions](#version-specific-upgrading-instructions): | [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 | The following table, while not exhaustive, shows some examples of the supported | ||||||
| upgrade paths. | upgrade paths. | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w | ||||||
| type: reference, howto | 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 | 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 | 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 |   - `crashes`: Holds all crash events the current job encountered as well as those not fixed in | ||||||
|     previous jobs. |     previous jobs. | ||||||
| 
 | 
 | ||||||
| ### Types of Fuzzing Jobs | ### Types of fuzzing jobs | ||||||
| 
 | 
 | ||||||
| There are two types of 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 | 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 | can therefore use all the options available in that fuzzing engine. For more information on these | ||||||
| options, see the underlying fuzzing engine's documentation. | options, see the underlying fuzzing engine's documentation. | ||||||
| 
 | 
 | ||||||
| ### Offline Environment | ### Offline environment | ||||||
| 
 | 
 | ||||||
| To use coverage fuzzing in an offline environment, follow these steps: | To use coverage fuzzing in an offline environment, follow these steps: | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w | ||||||
| FLAG: | FLAG: | ||||||
| On self-managed GitLab, by default this feature is available. To hide the feature, | 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). | 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 | 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 | whenever a project pipeline runs according to the configuration specified. Security teams can | ||||||
|  |  | ||||||
|  | @ -136,14 +136,14 @@ module QA | ||||||
|         end |         end | ||||||
| 
 | 
 | ||||||
|         def submit_pending_reviews |         def submit_pending_reviews | ||||||
|  |           has_element?(:submit_review_button) | ||||||
|           within_element(:review_bar_content) do |           within_element(:review_bar_content) do | ||||||
|             click_element(:review_preview_dropdown) |             click_element(:review_preview_dropdown) | ||||||
|             click_element(:submit_review_button) |             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 |           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 |         end | ||||||
| 
 | 
 | ||||||
|         def add_comment_to_diff(text) |         def add_comment_to_diff(text) | ||||||
|  |  | ||||||
|  | @ -63,7 +63,9 @@ function retrieve_tests_mapping() { | ||||||
|     local artifact_branch="master" |     local artifact_branch="master" | ||||||
|     local test_metadata_with_mapping_job_id |     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 |     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}" |      (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}" | ||||||
|  |  | ||||||
|  | @ -3310,6 +3310,16 @@ RSpec.describe Project, factory_default: :keep do | ||||||
|     end |     end | ||||||
|   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 |   describe '#lfs_objects_for_repository_types' do | ||||||
|     let(:project) { create(:project) } |     let(:project) { create(:project) } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3283,26 +3283,54 @@ RSpec.describe Repository do | ||||||
|   describe '#change_head' do |   describe '#change_head' do | ||||||
|     let(:branch) { repository.container.default_branch } |     let(:branch) { repository.container.default_branch } | ||||||
| 
 | 
 | ||||||
|     it 'adds an error to container if branch does not exist' do |     context 'when the branch exists' do | ||||||
|       expect(repository.change_head('unexisted-branch')).to be false |       it 'returns truthy' do | ||||||
|       expect(repository.container.errors.size).to eq(1) |         expect(repository.change_head(branch)).to be_truthy | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|  |       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 | ||||||
|  | 
 | ||||||
|  |       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 'reloads the default branch' do | ||||||
|  |         expect(repository.container).to receive(:reload_default_branch) | ||||||
|  |         repository.change_head(branch) | ||||||
|  |       end | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     it 'calls the before_change_head and after_change_head methods' do |     context 'when the branch does not exist' do | ||||||
|       expect(repository).to receive(:before_change_head) |       let(:branch) { 'non-existent-branch' } | ||||||
|       expect(repository).to receive(:after_change_head) |  | ||||||
| 
 | 
 | ||||||
|       repository.change_head(branch) |       it 'returns falsey' do | ||||||
|     end |         expect(repository.change_head(branch)).to be_falsey | ||||||
|  |       end | ||||||
| 
 | 
 | ||||||
|     it 'copies the gitattributes' do |       it 'calls container.after_change_head_branch_does_not_exist' do | ||||||
|       expect(repository).to receive(:copy_gitattributes).with(branch) |         expect(repository.container).to receive(:after_change_head_branch_does_not_exist).with(branch) | ||||||
|       repository.change_head(branch) |  | ||||||
|     end |  | ||||||
| 
 | 
 | ||||||
|     it 'reloads the default branch' do |         repository.change_head(branch) | ||||||
|       expect(repository.container).to receive(:reload_default_branch) |       end | ||||||
|       repository.change_head(branch) | 
 | ||||||
|  |       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 |   end | ||||||
| end | end | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue