Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
		
							parent
							
								
									2744f5f9d7
								
							
						
					
					
						commit
						dd28adcbf0
					
				|  | @ -80,6 +80,15 @@ export default { | ||||||
|     userPath() { |     userPath() { | ||||||
|       return this.user?.path; |       return this.user?.path; | ||||||
|     }, |     }, | ||||||
|  |     deployable() { | ||||||
|  |       return this.deployment?.deployable; | ||||||
|  |     }, | ||||||
|  |     jobName() { | ||||||
|  |       return truncate(this.deployable?.name ?? '', 25); | ||||||
|  |     }, | ||||||
|  |     jobPath() { | ||||||
|  |       return this.deployable?.buildPath; | ||||||
|  |     }, | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|     toggleCollapse() { |     toggleCollapse() { | ||||||
|  | @ -94,6 +103,8 @@ export default { | ||||||
|     showDetails: __('Show details'), |     showDetails: __('Show details'), | ||||||
|     hideDetails: __('Hide details'), |     hideDetails: __('Hide details'), | ||||||
|     triggerer: s__('Deployment|Triggerer'), |     triggerer: s__('Deployment|Triggerer'), | ||||||
|  |     job: __('Job'), | ||||||
|  |     api: __('API'), | ||||||
|   }, |   }, | ||||||
|   headerClasses: [ |   headerClasses: [ | ||||||
|     'gl-display-flex', |     'gl-display-flex', | ||||||
|  | @ -174,6 +185,20 @@ export default { | ||||||
|           <span class="gl-text-gray-500 gl-font-weight-bold">{{ $options.i18n.triggerer }}</span> |           <span class="gl-text-gray-500 gl-font-weight-bold">{{ $options.i18n.triggerer }}</span> | ||||||
|           <gl-link :href="userPath" class="gl-font-monospace gl-mt-3"> @{{ username }} </gl-link> |           <gl-link :href="userPath" class="gl-font-monospace gl-mt-3"> @{{ username }} </gl-link> | ||||||
|         </div> |         </div> | ||||||
|  |         <div class="gl-display-flex gl-flex-direction-column gl-ml-5"> | ||||||
|  |           <span class="gl-text-gray-500 gl-font-weight-bold" :class="{ 'gl-ml-3': !deployable }"> | ||||||
|  |             {{ $options.i18n.job }} | ||||||
|  |           </span> | ||||||
|  |           <gl-link v-if="jobPath" :href="jobPath" class="gl-font-monospace gl-mt-3"> | ||||||
|  |             {{ jobName }} | ||||||
|  |           </gl-link> | ||||||
|  |           <span v-else-if="jobName" class="gl-font-monospace gl-mt-3"> | ||||||
|  |             {{ jobName }} | ||||||
|  |           </span> | ||||||
|  |           <gl-badge v-else class="gl-font-monospace gl-mt-3" variant="info"> | ||||||
|  |             {{ $options.i18n.api }} | ||||||
|  |           </gl-badge> | ||||||
|  |         </div> | ||||||
|       </div> |       </div> | ||||||
|     </gl-collapse> |     </gl-collapse> | ||||||
|   </div> |   </div> | ||||||
|  |  | ||||||
|  | @ -148,12 +148,7 @@ | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   .gl-label .gl-label-link:hover { |   .gl-label .gl-label-link:hover { | ||||||
|     text-decoration: none; |  | ||||||
|     color: inherit; |     color: inherit; | ||||||
| 
 |  | ||||||
|     .gl-label-text:last-of-type { |  | ||||||
|       text-decoration: underline; |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   .btn-link { |   .btn-link { | ||||||
|  |  | ||||||
|  | @ -18,6 +18,9 @@ module Mutations | ||||||
|       argument :state_event, Types::WorkItems::StateEventEnum, |       argument :state_event, Types::WorkItems::StateEventEnum, | ||||||
|                description: 'Close or reopen a work item.', |                description: 'Close or reopen a work item.', | ||||||
|                required: false |                required: false | ||||||
|  |       argument :title, GraphQL::Types::String, | ||||||
|  |                required: false, | ||||||
|  |                description: copy_field_description(Types::WorkItemType, :title) | ||||||
| 
 | 
 | ||||||
|       field :work_item, Types::WorkItemType, |       field :work_item, Types::WorkItemType, | ||||||
|             null: true, |             null: true, | ||||||
|  |  | ||||||
|  | @ -4,10 +4,14 @@ group: Respond | ||||||
| info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments | info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments | ||||||
| --- | --- | ||||||
| 
 | 
 | ||||||
| # Self monitoring project **(FREE SELF)** | # Self-monitoring project (DEPRECATED) **(FREE SELF)** | ||||||
| 
 | 
 | ||||||
| > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/32351) in GitLab 12.7, behind a disabled feature flag (`self_monitoring_project`). | > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/32351) in GitLab 12.7 [with a flag](../../feature_flags.md) named `self_monitoring_project`. Disabled by default. | ||||||
| > - The feature flag was removed and the self monitoring project was [made generally available](https://gitlab.com/gitlab-org/gitlab/-/issues/198511) in GitLab 12.8. | > - Generally available in GitLab 12.8. [Feature flag `self_monitoring_project`](https://gitlab.com/gitlab-org/gitlab/-/issues/198511) removed. | ||||||
|  | > - [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/348909) in GitLab 14.8. | ||||||
|  | 
 | ||||||
|  | WARNING: | ||||||
|  | This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/348909) in GitLab 14.8. | ||||||
| 
 | 
 | ||||||
| GitLab provides administrators insights into the health of their GitLab instance. | GitLab provides administrators insights into the health of their GitLab instance. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -5202,6 +5202,7 @@ Input type: `WorkItemUpdateInput` | ||||||
| | <a id="mutationworkitemupdateclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | | | <a id="mutationworkitemupdateclientmutationid"></a>`clientMutationId` | [`String`](#string) | A unique identifier for the client performing the mutation. | | ||||||
| | <a id="mutationworkitemupdateid"></a>`id` | [`WorkItemID!`](#workitemid) | Global ID of the work item. | | | <a id="mutationworkitemupdateid"></a>`id` | [`WorkItemID!`](#workitemid) | Global ID of the work item. | | ||||||
| | <a id="mutationworkitemupdatestateevent"></a>`stateEvent` | [`WorkItemStateEvent`](#workitemstateevent) | Close or reopen a work item. | | | <a id="mutationworkitemupdatestateevent"></a>`stateEvent` | [`WorkItemStateEvent`](#workitemstateevent) | Close or reopen a work item. | | ||||||
|  | | <a id="mutationworkitemupdatetitle"></a>`title` | [`String`](#string) | Title of the work item. | | ||||||
| 
 | 
 | ||||||
| #### Fields | #### Fields | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -338,7 +338,7 @@ To support the following package managers, the GitLab analyzers proceed in two s | ||||||
| | Package Manager | Preinstalled Versions                                                                                                                                                                    | Tested Versions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | | Package Manager | Preinstalled Versions                                                                                                                                                                    | Tested Versions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ||||||
| | ------          | ------                                                                                                                                                                                   | ------                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | | ------          | ------                                                                                                                                                                                   | ------                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ||||||
| | Bundler         | [2.1.4](https://gitlab.com/gitlab-org/security-products/analyzers/bundler-audit/-/blob/v2.11.3/Dockerfile#L15)<sup><b><a href="#exported-dependency-information-notes-1">1</a></b></sup> | [1.17.3](https://gitlab.com/gitlab-org/security-products/tests/ruby-bundler/-/blob/master/Gemfile.lock#L118), [2.1.4](https://gitlab.com/gitlab-org/security-products/tests/ruby-bundler/-/blob/bundler2-FREEZE/Gemfile.lock#L118)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | | Bundler         | [2.1.4](https://gitlab.com/gitlab-org/security-products/analyzers/bundler-audit/-/blob/v2.11.3/Dockerfile#L15)<sup><b><a href="#exported-dependency-information-notes-1">1</a></b></sup> | [1.17.3](https://gitlab.com/gitlab-org/security-products/tests/ruby-bundler/-/blob/master/Gemfile.lock#L118), [2.1.4](https://gitlab.com/gitlab-org/security-products/tests/ruby-bundler/-/blob/bundler2-FREEZE/Gemfile.lock#L118)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ||||||
| | sbt             | [1.3.8](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.23.0/config/.tool-versions#L4)                                                               | [1.0.4](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/master/.gitlab-ci.yml#L263), [1.1.4](https://gitlab.com/gitlab-org/security-products/tests/scala-sbt-multiproject/-/blob/main/project/build.properties#L1), [1.1.6](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/master/.gitlab-ci.yml#L272), [1.2.8](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/master/.gitlab-ci.yml#L281), [1.3.12](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/master/.gitlab-ci.yml#L290), [1.4.6](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/master/.gitlab-ci.yml#L299) | | | sbt             | [1.6.1](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/config/.tool-versions#L4)                                                               | [1.0.4](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L330), [1.1.4](https://gitlab.com/gitlab-org/security-products/tests/scala-sbt-multiproject/-/blob/main/project/build.properties#L1), [1.1.6](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L339), [1.2.8](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L348), [1.3.12](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L357), [1.4.6](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L366), [1.6.1](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.24.6/.gitlab-ci.yml#L384) | | ||||||
| | Maven           | [3.6.3](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.23.0/config/.tool-versions#L3)                                                               | [3.6.3](https://gitlab.com/gitlab-org/security-products/tests/java-maven/-/blob/master/pom.xml#L3)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | | Maven           | [3.6.3](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.23.0/config/.tool-versions#L3)                                                               | [3.6.3](https://gitlab.com/gitlab-org/security-products/tests/java-maven/-/blob/master/pom.xml#L3)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | | ||||||
| | Gradle          | [6.7.1](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.23.0/config/.tool-versions#L5)                                                               | [5.6.4](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/master/gradle/wrapper/gradle-wrapper.properties#L3), [6.5](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-14/gradle/wrapper/gradle-wrapper.properties#L3), [6.7-rc-1](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-15/gradle/wrapper/gradle-wrapper.properties#L3), [6.9](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-14-gradle-6-9/gradle/wrapper/gradle-wrapper.properties#L3), [7.0-rc-2](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-16/gradle/wrapper/gradle-wrapper.properties#L3)                                | | | Gradle          | [6.7.1](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium-maven/-/blob/v2.23.0/config/.tool-versions#L5)                                                               | [5.6.4](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/master/gradle/wrapper/gradle-wrapper.properties#L3), [6.5](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-14/gradle/wrapper/gradle-wrapper.properties#L3), [6.7-rc-1](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-15/gradle/wrapper/gradle-wrapper.properties#L3), [6.9](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-14-gradle-6-9/gradle/wrapper/gradle-wrapper.properties#L3), [7.0-rc-2](https://gitlab.com/gitlab-org/security-products/tests/java-gradle/-/blob/java-16/gradle/wrapper/gradle-wrapper.properties#L3)                                | | ||||||
| | setuptools      | [50.3.2](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium/-/blob/v2.29.9/Dockerfile#L27)                                                                              | [57.5.0](https://gitlab.com/gitlab-org/security-products/tests/python-setuptools/-/blob/main/setup.py)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | | setuptools      | [50.3.2](https://gitlab.com/gitlab-org/security-products/analyzers/gemnasium/-/blob/v2.29.9/Dockerfile#L27)                                                                              | [57.5.0](https://gitlab.com/gitlab-org/security-products/tests/python-setuptools/-/blob/main/setup.py)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | | ||||||
|  |  | ||||||
|  | @ -32,7 +32,7 @@ module API | ||||||
|         success Entities::Commit |         success Entities::Commit | ||||||
|       end |       end | ||||||
|       params do |       params do | ||||||
|         optional :ref_name, type: String, desc: 'The name of a repository branch or tag, if not given the default branch is used' |         optional :ref_name, type: String, desc: 'The name of a repository branch or tag, if not given the default branch is used', regexp: /\A#{Gitlab::PathRegex.git_reference_regex}\z|\A\z/ | ||||||
|         optional :since, type: DateTime, desc: 'Only commits after or on this date will be returned' |         optional :since, type: DateTime, desc: 'Only commits after or on this date will be returned' | ||||||
|         optional :until, type: DateTime, desc: 'Only commits before or on this date will be returned' |         optional :until, type: DateTime, desc: 'Only commits before or on this date will be returned' | ||||||
|         optional :path, type: String, desc: 'The file path' |         optional :path, type: String, desc: 'The file path' | ||||||
|  |  | ||||||
|  | @ -126,8 +126,10 @@ module ExtractsRef | ||||||
| 
 | 
 | ||||||
|   # overridden in subclasses, do not remove |   # overridden in subclasses, do not remove | ||||||
|   def get_id |   def get_id | ||||||
|     id = [params[:id] || params[:ref]] |     allowed_params = params.permit(:id, :ref, :path) | ||||||
|     id << "/" + params[:path] unless params[:path].blank? | 
 | ||||||
|  |     id = [allowed_params[:id] || allowed_params[:ref]] | ||||||
|  |     id << "/" + allowed_params[:path] unless allowed_params[:path].blank? | ||||||
|     id.join |     id.join | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -234,7 +234,7 @@ module Gitlab | ||||||
|       @git_reference_regex ||= single_line_regexp %r{ |       @git_reference_regex ||= single_line_regexp %r{ | ||||||
|         (?! |         (?! | ||||||
|            (?# doesn't begins with) |            (?# doesn't begins with) | ||||||
|            \/|                    (?# rule #6) |            \/|-|                  (?# rule #6) | ||||||
|            (?# doesn't contain) |            (?# doesn't contain) | ||||||
|            .*(?: |            .*(?: | ||||||
|               [\/.]\.|            (?# rule #1,3) |               [\/.]\.|            (?# rule #1,3) | ||||||
|  |  | ||||||
|  | @ -209,6 +209,36 @@ describe('~/environments/components/deployment.vue', () => { | ||||||
|       const username = wrapper.findByRole('link', { name: `@${deployment.user.username}` }); |       const username = wrapper.findByRole('link', { name: `@${deployment.user.username}` }); | ||||||
| 
 | 
 | ||||||
|       expect(username.attributes('href')).toBe(deployment.user.path); |       expect(username.attributes('href')).toBe(deployment.user.path); | ||||||
|  |       const job = wrapper.findByRole('link', { name: deployment.deployable.name }); | ||||||
|  |       expect(job.attributes('href')).toBe(deployment.deployable.buildPath); | ||||||
|  |       const apiBadge = wrapper.findByText(__('API')); | ||||||
|  |       expect(apiBadge.exists()).toBe(false); | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
|  |   describe('with API deployment', () => { | ||||||
|  |     beforeEach(async () => { | ||||||
|  |       wrapper = createWrapper({ propsData: { deployment: { ...deployment, deployable: null } } }); | ||||||
|  |       await wrapper.findComponent({ ref: 'details-toggle' }).trigger('click'); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     it('shows API instead of a job name', () => { | ||||||
|  |       const apiBadge = wrapper.findByText(__('API')); | ||||||
|  |       expect(apiBadge.exists()).toBe(true); | ||||||
|  |     }); | ||||||
|  |   }); | ||||||
|  |   describe('without a job path', () => { | ||||||
|  |     beforeEach(async () => { | ||||||
|  |       wrapper = createWrapper({ | ||||||
|  |         propsData: { | ||||||
|  |           deployment: { ...deployment, deployable: { name: deployment.deployable.name } }, | ||||||
|  |         }, | ||||||
|  |       }); | ||||||
|  |       await wrapper.findComponent({ ref: 'details-toggle' }).trigger('click'); | ||||||
|  |     }); | ||||||
|  | 
 | ||||||
|  |     it('shows a span instead of a link', () => { | ||||||
|  |       const job = wrapper.findByText(deployment.deployable.name); | ||||||
|  |       expect(job.attributes('href')).toBeUndefined(); | ||||||
|     }); |     }); | ||||||
|   }); |   }); | ||||||
| }); | }); | ||||||
|  |  | ||||||
|  | @ -32,7 +32,7 @@ RSpec.describe ExtractsPath do | ||||||
|   describe '#assign_ref_vars' do |   describe '#assign_ref_vars' do | ||||||
|     let(:ref) { sample_commit[:id] } |     let(:ref) { sample_commit[:id] } | ||||||
|     let(:path) { sample_commit[:line_code_path] } |     let(:path) { sample_commit[:line_code_path] } | ||||||
|     let(:params) { { path: path, ref: ref } } |     let(:params) { ActionController::Parameters.new(path: path, ref: ref) } | ||||||
| 
 | 
 | ||||||
|     it_behaves_like 'assigns ref vars' |     it_behaves_like 'assigns ref vars' | ||||||
| 
 | 
 | ||||||
|  | @ -54,7 +54,8 @@ RSpec.describe ExtractsPath do | ||||||
| 
 | 
 | ||||||
|     context 'ref only exists without .atom suffix' do |     context 'ref only exists without .atom suffix' do | ||||||
|       context 'with a path' do |       context 'with a path' do | ||||||
|         let(:params) { { ref: 'v1.0.0.atom', path: 'README.md' } } |         let(:ref) { 'v1.0.0.atom' } | ||||||
|  |         let(:path) { 'README.md' } | ||||||
| 
 | 
 | ||||||
|         it 'renders a 404' do |         it 'renders a 404' do | ||||||
|           expect(self).to receive(:render_404) |           expect(self).to receive(:render_404) | ||||||
|  | @ -64,7 +65,8 @@ RSpec.describe ExtractsPath do | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|       context 'without a path' do |       context 'without a path' do | ||||||
|         let(:params) { { ref: 'v1.0.0.atom' } } |         let(:ref) { 'v1.0.0.atom' } | ||||||
|  |         let(:path) { nil } | ||||||
| 
 | 
 | ||||||
|         before do |         before do | ||||||
|           assign_ref_vars |           assign_ref_vars | ||||||
|  | @ -82,7 +84,8 @@ RSpec.describe ExtractsPath do | ||||||
| 
 | 
 | ||||||
|     context 'ref exists with .atom suffix' do |     context 'ref exists with .atom suffix' do | ||||||
|       context 'with a path' do |       context 'with a path' do | ||||||
|         let(:params) { { ref: 'master.atom', path: 'README.md' } } |         let(:ref) { 'master.atom' } | ||||||
|  |         let(:path) { 'README.md' } | ||||||
| 
 | 
 | ||||||
|         before do |         before do | ||||||
|           repository = @project.repository |           repository = @project.repository | ||||||
|  | @ -102,7 +105,8 @@ RSpec.describe ExtractsPath do | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|       context 'without a path' do |       context 'without a path' do | ||||||
|         let(:params) { { ref: 'master.atom' } } |         let(:ref) { 'master.atom' } | ||||||
|  |         let(:path) { nil } | ||||||
| 
 | 
 | ||||||
|         before do |         before do | ||||||
|           repository = @project.repository |           repository = @project.repository | ||||||
|  | @ -125,7 +129,8 @@ RSpec.describe ExtractsPath do | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|     context 'ref and path are nil' do |     context 'ref and path are nil' do | ||||||
|       let(:params) { { path: nil, ref: nil } } |       let(:path) { nil } | ||||||
|  |       let(:ref) { nil } | ||||||
| 
 | 
 | ||||||
|       it 'does not set commit' do |       it 'does not set commit' do | ||||||
|         expect(container.repository).not_to receive(:commit).with('') |         expect(container.repository).not_to receive(:commit).with('') | ||||||
|  |  | ||||||
|  | @ -10,7 +10,8 @@ RSpec.describe ExtractsRef do | ||||||
|   let_it_be(:container) { create(:snippet, :repository, author: owner) } |   let_it_be(:container) { create(:snippet, :repository, author: owner) } | ||||||
| 
 | 
 | ||||||
|   let(:ref) { sample_commit[:id] } |   let(:ref) { sample_commit[:id] } | ||||||
|   let(:params) { { path: sample_commit[:line_code_path], ref: ref } } |   let(:path) { sample_commit[:line_code_path] } | ||||||
|  |   let(:params) { ActionController::Parameters.new(path: path, ref: ref) } | ||||||
| 
 | 
 | ||||||
|   before do |   before do | ||||||
|     ref_names = ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0', 'release/app', 'release/app/v1.0.0'] |     ref_names = ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0', 'release/app', 'release/app/v1.0.0'] | ||||||
|  | @ -23,7 +24,8 @@ RSpec.describe ExtractsRef do | ||||||
|     it_behaves_like 'assigns ref vars' |     it_behaves_like 'assigns ref vars' | ||||||
| 
 | 
 | ||||||
|     context 'ref and path are nil' do |     context 'ref and path are nil' do | ||||||
|       let(:params) { { path: nil, ref: nil } } |       let(:ref) { nil } | ||||||
|  |       let(:path) { nil } | ||||||
| 
 | 
 | ||||||
|       it 'does not set commit' do |       it 'does not set commit' do | ||||||
|         expect(container.repository).not_to receive(:commit).with('') |         expect(container.repository).not_to receive(:commit).with('') | ||||||
|  | @ -33,6 +35,15 @@ RSpec.describe ExtractsRef do | ||||||
|         expect(@commit).to be_nil |         expect(@commit).to be_nil | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|  | 
 | ||||||
|  |     context 'when ref and path have incorrect format' do | ||||||
|  |       let(:ref) { { wrong: :format } } | ||||||
|  |       let(:path) { { also: :wrong } } | ||||||
|  | 
 | ||||||
|  |       it 'does not raise an exception' do | ||||||
|  |         expect { assign_ref_vars }.not_to raise_error | ||||||
|  |       end | ||||||
|  |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   it_behaves_like 'extracts refs' |   it_behaves_like 'extracts refs' | ||||||
|  |  | ||||||
|  | @ -530,6 +530,18 @@ RSpec.describe Gitlab::PathRegex do | ||||||
|       it { is_expected.not_to match('snippets/1.wiki.git') } |       it { is_expected.not_to match('snippets/1.wiki.git') } | ||||||
|     end |     end | ||||||
| 
 | 
 | ||||||
|  |     describe '.git_reference_regex' do | ||||||
|  |       subject { %r{\A#{described_class.git_reference_regex}\z} } | ||||||
|  | 
 | ||||||
|  |       it { is_expected.to match('main') } | ||||||
|  |       it { is_expected.to match('v1.2.3') } | ||||||
|  |       it { is_expected.to match('refs/heads/main') } | ||||||
|  |       it { is_expected.to match('1-2-3') } | ||||||
|  |       it { is_expected.to match('1-----') } | ||||||
|  |       it { is_expected.not_to match('-main') } | ||||||
|  |       it { is_expected.not_to match('') } | ||||||
|  |     end | ||||||
|  | 
 | ||||||
|     describe '.full_snippets_repository_path_regex' do |     describe '.full_snippets_repository_path_regex' do | ||||||
|       subject { described_class.full_snippets_repository_path_regex } |       subject { described_class.full_snippets_repository_path_regex } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -127,6 +127,14 @@ RSpec.describe API::Commits do | ||||||
|         it_behaves_like 'project commits' |         it_behaves_like 'project commits' | ||||||
|       end |       end | ||||||
| 
 | 
 | ||||||
|  |       context 'with incorrect ref_name parameter' do | ||||||
|  |         let(:route) { "/projects/#{project_id}/repository/commits?ref_name=-main" } | ||||||
|  | 
 | ||||||
|  |         it_behaves_like '400 response' do | ||||||
|  |           let(:request) { get api(route, user) } | ||||||
|  |         end | ||||||
|  |       end | ||||||
|  | 
 | ||||||
|       context "path optional parameter" do |       context "path optional parameter" do | ||||||
|         it "returns project commits matching provided path parameter" do |         it "returns project commits matching provided path parameter" do | ||||||
|           path = 'files/ruby/popen.rb' |           path = 'files/ruby/popen.rb' | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ RSpec.describe 'Update a work item' do | ||||||
|   let_it_be(:work_item, refind: true) { create(:work_item, project: project) } |   let_it_be(:work_item, refind: true) { create(:work_item, project: project) } | ||||||
| 
 | 
 | ||||||
|   let(:work_item_event) { 'CLOSE' } |   let(:work_item_event) { 'CLOSE' } | ||||||
|   let(:input) { { 'stateEvent' => work_item_event } } |   let(:input) { { 'stateEvent' => work_item_event, 'title' => 'updated title' } } | ||||||
| 
 | 
 | ||||||
|   let(:mutation) { graphql_mutation(:workItemUpdate, input.merge('id' => work_item.to_global_id.to_s)) } |   let(:mutation) { graphql_mutation(:workItemUpdate, input.merge('id' => work_item.to_global_id.to_s)) } | ||||||
| 
 | 
 | ||||||
|  | @ -26,15 +26,18 @@ RSpec.describe 'Update a work item' do | ||||||
|     let(:current_user) { developer } |     let(:current_user) { developer } | ||||||
| 
 | 
 | ||||||
|     context 'when the work item is open' do |     context 'when the work item is open' do | ||||||
|       it 'closes the work item' do |       it 'closes and updates the work item' do | ||||||
|         expect do |         expect do | ||||||
|           post_graphql_mutation(mutation, current_user: current_user) |           post_graphql_mutation(mutation, current_user: current_user) | ||||||
|           work_item.reload |           work_item.reload | ||||||
|         end.to change(work_item, :state).from('opened').to('closed') |         end.to change(work_item, :state).from('opened').to('closed').and( | ||||||
|  |           change(work_item, :title).from(work_item.title).to('updated title') | ||||||
|  |         ) | ||||||
| 
 | 
 | ||||||
|         expect(response).to have_gitlab_http_status(:success) |         expect(response).to have_gitlab_http_status(:success) | ||||||
|         expect(mutation_response['workItem']).to include( |         expect(mutation_response['workItem']).to include( | ||||||
|           'state' => 'CLOSED' |           'state' => 'CLOSED', | ||||||
|  |           'title' => 'updated title' | ||||||
|         ) |         ) | ||||||
|       end |       end | ||||||
|     end |     end | ||||||
|  |  | ||||||
|  | @ -40,12 +40,13 @@ RSpec.shared_examples 'assigns ref vars' do | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|   context 'path contains space' do |   context 'path contains space' do | ||||||
|     let(:params) { { path: 'with space', ref: '38008cb17ce1466d8fec2dfa6f6ab8dcfe5cf49e' } } |     let(:ref) { '38008cb17ce1466d8fec2dfa6f6ab8dcfe5cf49e' } | ||||||
|  |     let(:path) { 'with space' } | ||||||
| 
 | 
 | ||||||
|     it 'is not converted to %20 in @path' do |     it 'is not converted to %20 in @path' do | ||||||
|       assign_ref_vars |       assign_ref_vars | ||||||
| 
 | 
 | ||||||
|       expect(@path).to eq(params[:path]) |       expect(@path).to eq(path) | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue