diff --git a/app/assets/javascripts/merge_conflicts/merge_conflict_resolver_app.vue b/app/assets/javascripts/merge_conflicts/merge_conflict_resolver_app.vue index 20ee9a17fa0..af66600089f 100644 --- a/app/assets/javascripts/merge_conflicts/merge_conflict_resolver_app.vue +++ b/app/assets/javascripts/merge_conflicts/merge_conflict_resolver_app.vue @@ -33,7 +33,7 @@ export default { i18n: { commitStatSummary: __('Showing %{conflict}'), resolveInfo: __( - 'You can resolve the merge conflict using either the Interactive mode, by choosing %{use_ours} or %{use_theirs} buttons, or by editing the files directly. Commit these changes into %{branch_name}', + 'You can resolve the merge conflict using either the Interactive mode, by choosing %{use_ours} or %{use_theirs} buttons, or by editing the files directly. Commit these changes into %{branch_name}.', ), }, computed: { @@ -148,10 +148,10 @@ export default { -
+
@@ -164,8 +164,7 @@ export default {
-
-
+

@@ -180,9 +179,7 @@ export default { {{ s__('MergeConflict|Use theirs') }}

@@ -204,7 +201,7 @@ export default { {{ getCommitButtonText }} diff --git a/app/assets/stylesheets/framework/diffs.scss b/app/assets/stylesheets/framework/diffs.scss index ad09740583b..9ec87b4f304 100644 --- a/app/assets/stylesheets/framework/diffs.scss +++ b/app/assets/stylesheets/framework/diffs.scss @@ -9,7 +9,7 @@ } table.code tr:last-of-type td:last-of-type { - @include gl-rounded-bottom-right-base(); + border-bottom-right-radius: $border-radius-default - 1px; } .file-title, @@ -546,7 +546,7 @@ table.code { .line_holder:last-of-type { .diff-td:first-child, td:first-child { - border-bottom-left-radius: $border-radius-default; + border-bottom-left-radius: $border-radius-default - 1px; } } diff --git a/app/views/projects/merge_requests/conflicts/show.html.haml b/app/views/projects/merge_requests/conflicts/show.html.haml index a882196ffa2..3facca4d4f7 100644 --- a/app/views/projects/merge_requests/conflicts/show.html.haml +++ b/app/views/projects/merge_requests/conflicts/show.html.haml @@ -1,3 +1,6 @@ +- add_to_breadcrumbs _("Merge requests"), project_merge_requests_path(@project) +- add_to_breadcrumbs @merge_request.to_reference, project_merge_request_path(@project, @merge_request) +- breadcrumb_title _("Merge conflicts") - page_title _("Merge Conflicts"), "#{@merge_request.title} (#{@merge_request.to_reference}", _("Merge requests") - add_page_specific_style 'page_bundles/merge_conflicts' diff --git a/config/feature_flags/development/limited_commit_parser.yml b/config/feature_flags/development/limited_commit_parser.yml deleted file mode 100644 index 026d7824aaf..00000000000 --- a/config/feature_flags/development/limited_commit_parser.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: limited_commit_parser -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/117188 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/406461 -milestone: '15.11' -type: development -group: group::source code -default_enabled: false diff --git a/data/deprecations/15-9-required-pipeline-configuration.yml b/data/deprecations/15-9-required-pipeline-configuration.yml index 4aa3a83c51e..03ebaab555d 100644 --- a/data/deprecations/15-9-required-pipeline-configuration.yml +++ b/data/deprecations/15-9-required-pipeline-configuration.yml @@ -3,13 +3,13 @@ # - title: "Required Pipeline Configuration is deprecated" # (required) Clearly explain the change, or planned change. For example, "The `confidential` field for a `Note` is deprecated" or "CI/CD job names will be limited to 250 characters." announcement_milestone: "15.9" # (required) The milestone when this feature was first announced as deprecated. - removal_milestone: "16.0" # (required) The milestone when this feature is planned to be removed + removal_milestone: "17.0" # (required) The milestone when this feature is planned to be removed breaking_change: true # (required) Change to false if this is not a breaking change. - reporter: jheimbuck_gl # (required) GitLab username of the person reporting the change - stage: Verify # (required) String value of the stage that the feature was created in. e.g., Growth + reporter: derekferguson # (required) GitLab username of the person reporting the change + stage: Compliance Management # (required) String value of the stage that the feature was created in. e.g., Growth issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/389467 # (required) Link to the deprecation issue in GitLab body: | # (required) Do not modify this line, instead modify the lines below. - Required Pipeline Configuration will be removed in the 16.0 release. This impacts self-managed users on the Ultimate license. + Required Pipeline Configuration will be removed in the 17.0 release. This impacts self-managed users on the Ultimate license. We recommend replacing this with an alternative [compliance solution](https://docs.gitlab.com/ee/user/group/compliance_frameworks.html#compliance-pipelines) that is available now. We recommend this alternative solution because it provides greater flexibility, allowing required pipelines to be assigned to specific compliance framework labels. diff --git a/db/post_migrate/20230414140202_add_issues_incident_type_temp_index_async_dot_com.rb b/db/post_migrate/20230414140202_add_issues_incident_type_temp_index_async_dot_com.rb new file mode 100644 index 00000000000..9caa6f16669 --- /dev/null +++ b/db/post_migrate/20230414140202_add_issues_incident_type_temp_index_async_dot_com.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class AddIssuesIncidentTypeTempIndexAsyncDotCom < Gitlab::Database::Migration[2.1] + INDEX_NAME = 'tmp_index_issues_on_issue_type_and_id_only_incidents' + INCIDENT_ENUM_VALUE = 1 + + # TODO: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/117728 + def up + prepare_async_index :issues, [:issue_type, :id], name: INDEX_NAME, where: "issue_type = #{INCIDENT_ENUM_VALUE}" + end + + def down + unprepare_async_index :issues, [:issue_type, :id], name: INDEX_NAME + end +end diff --git a/db/schema_migrations/20230414140202 b/db/schema_migrations/20230414140202 new file mode 100644 index 00000000000..6e50edaa549 --- /dev/null +++ b/db/schema_migrations/20230414140202 @@ -0,0 +1 @@ +253faa0063e11decde1c0aacc1c15cbf3035e533934a6cd1d3da46e5a4a4eae4 \ No newline at end of file diff --git a/doc/api/status_checks.md b/doc/api/status_checks.md index 7bff242dd3f..c024558b90c 100644 --- a/doc/api/status_checks.md +++ b/doc/api/status_checks.md @@ -10,9 +10,92 @@ type: reference, api > - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3869) in GitLab 14.0, disabled behind the `:ff_external_status_checks` feature flag. > - [Feature flag removed](https://gitlab.com/gitlab-org/gitlab/-/issues/320783) in GitLab 14.1. +## Get project external status check services + +You can request information about a project's external status check services using the following endpoint: + +```plaintext +GET /projects/:id/external_status_checks +``` + +**Parameters:** + +| Attribute | Type | Required | Description | +|---------------------|---------|----------|---------------------| +| `id` | integer | yes | ID of a project | + +```json +[ + { + "id": 1, + "name": "Compliance Tool", + "project_id": 6, + "external_url": "https://gitlab.com/example/compliance-tool", + "protected_branches": [ + { + "id": 14, + "project_id": 6, + "name": "master", + "created_at": "2020-10-12T14:04:50.787Z", + "updated_at": "2020-10-12T14:04:50.787Z", + "code_owner_approval_required": false + } + ] + } +] +``` + +## Create external status check service + +You can create a new external status check service for a project using the following endpoint: + +```plaintext +POST /projects/:id/external_status_checks +``` + +WARNING: +External status checks send information about all applicable merge requests to the +defined external service. This includes confidential merge requests. + +| Attribute | Type | Required | Description | +|------------------------|------------------|----------|------------------------------------------------| +| `id` | integer | yes | ID of a project | +| `name` | string | yes | Display name of external status check service | +| `external_url` | string | yes | URL of external status check service | +| `protected_branch_ids` | `array` | no | IDs of protected branches to scope the rule by | + +## Update external status check service + +You can update an existing external status check for a project using the following endpoint: + +```plaintext +PUT /projects/:id/external_status_checks/:check_id +``` + +| Attribute | Type | Required | Description | +|------------------------|------------------|----------|------------------------------------------------| +| `id` | integer | yes | ID of a project | +| `check_id` | integer | yes | ID of an external status check service | +| `name` | string | no | Display name of external status check service | +| `external_url` | string | no | URL of external status check service | +| `protected_branch_ids` | `array` | no | IDs of protected branches to scope the rule by | + +## Delete external status check service + +You can delete an external status check service for a project using the following endpoint: + +```plaintext +DELETE /projects/:id/external_status_checks/:check_id +``` + +| Attribute | Type | Required | Description | +|------------------------|----------------|----------|----------------------------------------| +| `check_id` | integer | yes | ID of an external status check service | +| `id` | integer | yes | ID of a project | + ## List status checks for a merge request -For a single merge request, list the external status checks that apply to it and their status. +For a single merge request, list the external status check services that apply to it and their status. ```plaintext GET /projects/:id/merge_requests/:merge_request_iid/status_checks @@ -29,13 +112,13 @@ GET /projects/:id/merge_requests/:merge_request_iid/status_checks [ { "id": 2, - "name": "Rule 1", + "name": "Service 1", "external_url": "https://gitlab.com/test-endpoint", "status": "passed" }, { "id": 1, - "name": "Rule 2", + "name": "Service 2", "external_url": "https://gitlab.com/test-endpoint-2", "status": "pending" } @@ -251,89 +334,6 @@ In case status check is already passed status code is 422 } ``` -## Get project external status checks - -You can request information about a project's external status checks using the following endpoint: - -```plaintext -GET /projects/:id/external_status_checks -``` - -**Parameters:** - -| Attribute | Type | Required | Description | -|---------------------|---------|----------|---------------------| -| `id` | integer | yes | ID of a project | - -```json -[ - { - "id": 1, - "name": "Compliance Check", - "project_id": 6, - "external_url": "https://gitlab.com/example/test.json", - "protected_branches": [ - { - "id": 14, - "project_id": 6, - "name": "master", - "created_at": "2020-10-12T14:04:50.787Z", - "updated_at": "2020-10-12T14:04:50.787Z", - "code_owner_approval_required": false - } - ] - } -] -``` - -## Create external status check - -You can create a new external status check for a project using the following endpoint: - -```plaintext -POST /projects/:id/external_status_checks -``` - -WARNING: -External status checks send information about all applicable merge requests to the -defined external service. This includes confidential merge requests. - -| Attribute | Type | Required | Description | -|------------------------|------------------|----------|------------------------------------------------| -| `id` | integer | yes | ID of a project | -| `name` | string | yes | Display name of external status check | -| `external_url` | string | yes | URL of external status check resource | -| `protected_branch_ids` | `array` | no | IDs of protected branches to scope the rule by | - -## Delete external status check - -You can delete an external status check for a project using the following endpoint: - -```plaintext -DELETE /projects/:id/external_status_checks/:check_id -``` - -| Attribute | Type | Required | Description | -|------------------------|----------------|----------|-----------------------| -| `check_id` | integer | yes | ID of an external status check | -| `id` | integer | yes | ID of a project | - -## Update external status check - -You can update an existing external status check for a project using the following endpoint: - -```plaintext -PUT /projects/:id/external_status_checks/:check_id -``` - -| Attribute | Type | Required | Description | -|------------------------|------------------|----------|------------------------------------------------| -| `id` | integer | yes | ID of a project | -| `check_id` | integer | yes | ID of an external status check | -| `name` | string | no | Display name of external status check | -| `external_url` | string | no | URL of external status check resource | -| `protected_branch_ids` | `array` | no | IDs of protected branches to scope the rule by | - ## Related topics - [External status checks](../user/project/merge_requests/status_checks.md) diff --git a/doc/development/database/batched_background_migrations.md b/doc/development/database/batched_background_migrations.md index 7f3c5889017..326d2795558 100644 --- a/doc/development/database/batched_background_migrations.md +++ b/doc/development/database/batched_background_migrations.md @@ -444,24 +444,6 @@ background migration. - Continues using the data as before. - Ensures that both existing and new data are migrated. -1. In the next release, add a database migration to remove the trigger. - - ```ruby - class RemoveNamepaceIdTriggerFromRoutes < Gitlab::Database::Migration[2.1] - FUNCTION_NAME = 'example_function' - TRIGGER_NAME = 'example_trigger' - - def up - drop_trigger(TRIGGER_NAME, :routes) - drop_function(FUNCTION_NAME) - end - - def down - # Should reverse the trigger and the function in the up method of the migration that added it - end - end - ``` - 1. Add a new post-deployment migration that checks that the batched background migration is completed. For example: @@ -497,6 +479,24 @@ background migration. instance, the data is advisory, and not mission-critical), then you can skip this final step. This step confirms that the migration is completed, and all of the rows were migrated. +1. Add a database migration to remove the trigger. + + ```ruby + class RemoveNamepaceIdTriggerFromRoutes < Gitlab::Database::Migration[2.1] + FUNCTION_NAME = 'example_function' + TRIGGER_NAME = 'example_trigger' + + def up + drop_trigger(TRIGGER_NAME, :routes) + drop_function(FUNCTION_NAME) + end + + def down + # Should reverse the trigger and the function in the up method of the migration that added it + end + end + ``` + After the batched migration is completed, you can safely depend on the data in `routes.namespace_id` being populated. diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index 3a2b40a6cd5..dae5f319368 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -1216,11 +1216,17 @@ When you want to ensure that no event got called, you can use `expect_no_snowplo it 'does not track any snowplow events' do get :show - expect_no_snowplow_event + expect_no_snowplow_event(category: described_class.name, action: 'some_action') end end ``` +Even though `category` and `action` can be omitted, you should at least +specify a `category` to avoid flaky tests. For example, +`Users::ActivityService` may track a Snowplow event after an API +request, and `expect_no_snowplow_event` will fail if that happens to run +when no arguments are specified. + #### Test Snowplow context against the schema The [Snowplow schema matcher](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60480) diff --git a/doc/update/deprecations.md b/doc/update/deprecations.md index 4eb34a5a4af..1ebfff9acc5 100644 --- a/doc/update/deprecations.md +++ b/doc/update/deprecations.md @@ -268,6 +268,22 @@ to the `gitlab-runner register` command.
+### Required Pipeline Configuration is deprecated + +
+- Announced in: GitLab 15.9 +- [Breaking change](https://docs.gitlab.com/ee/development/deprecation_guidelines/) +
+ +Required Pipeline Configuration will be removed in the 17.0 release. This impacts self-managed users on the Ultimate license. + +We recommend replacing this with an alternative [compliance solution](https://docs.gitlab.com/ee/user/group/compliance_frameworks.html#compliance-pipelines) +that is available now. We recommend this alternative solution because it provides greater flexibility, allowing required pipelines to be assigned to specific compliance framework labels. + +
+ +
+ ### Self-managed certificate-based integration with Kubernetes
@@ -1546,22 +1562,6 @@ This could be a breaking change for anyone that developed their own runner that
-### Required Pipeline Configuration is deprecated - -
-- Announced in: GitLab 15.9 -- [Breaking change](https://docs.gitlab.com/ee/development/deprecation_guidelines/) -
- -Required Pipeline Configuration will be removed in the 16.0 release. This impacts self-managed users on the Ultimate license. - -We recommend replacing this with an alternative [compliance solution](https://docs.gitlab.com/ee/user/group/compliance_frameworks.html#compliance-pipelines) -that is available now. We recommend this alternative solution because it provides greater flexibility, allowing required pipelines to be assigned to specific compliance framework labels. - -
- -
- ### SAST analyzer coverage changing in GitLab 16.0
diff --git a/doc/user/admin_area/settings/continuous_integration.md b/doc/user/admin_area/settings/continuous_integration.md index 5d5cd15372a..a0a0dc65099 100644 --- a/doc/user/admin_area/settings/continuous_integration.md +++ b/doc/user/admin_area/settings/continuous_integration.md @@ -245,12 +245,13 @@ To enable or disable the banner: ## Required pipeline configuration **(ULTIMATE SELF)** -> [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/352316) from GitLab Premium to GitLab Ultimate in 15.0. +> - [Moved](https://gitlab.com/gitlab-org/gitlab/-/issues/352316) from GitLab Premium to GitLab Ultimate in 15.0. +> - [Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/389467) in GitLab 15.9. -NOTE: -An alternative [compliance solution](../../group/compliance_frameworks.md#compliance-pipelines) -is available. We recommend this alternative solution because it provides greater flexibility, -allowing required pipelines to be assigned to specific compliance framework labels. +WARNING: +This feature was [deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/389467) in GitLab 15.9 +and is planned for removal in 17.0. Use [compliance pipelines](../../group/compliance_frameworks.md#compliance-pipelines) +instead. This change is a breaking change. You can set a [CI/CD template](../../../ci/examples/index.md#cicd-templates) as a required pipeline configuration for all projects on a GitLab instance. You can diff --git a/doc/user/application_security/api_fuzzing/index.md b/doc/user/application_security/api_fuzzing/index.md index 8ae6d8ee675..836291f4f48 100644 --- a/doc/user/application_security/api_fuzzing/index.md +++ b/doc/user/application_security/api_fuzzing/index.md @@ -16,6 +16,9 @@ We recommend that you use fuzz testing in addition to [GitLab Secure](../index.m other security scanners and your own test processes. If you're using [GitLab CI/CD](../../../ci/index.md), you can run fuzz tests as part your CI/CD workflow. + +For an overview, see [Web API Fuzzing](https://www.youtube.com/watch?v=oUHsfvLGhDk). + ## When Web API fuzzing runs Web API fuzzing runs in the `fuzz` stage of the CI/CD pipeline. To ensure API fuzzing scans the diff --git a/doc/user/application_security/security_dashboard/index.md b/doc/user/application_security/security_dashboard/index.md index 1a8b4dac10e..e6cb4cef4b2 100644 --- a/doc/user/application_security/security_dashboard/index.md +++ b/doc/user/application_security/security_dashboard/index.md @@ -19,6 +19,9 @@ To use the Security Dashboards, you must: shared runners on GitLab.com, you are using the correct version. - Have the [correct role](../../permissions.md) for the project or group. + +For an overview, see [Security Dashboard](https://www.youtube.com/watch?v=QHQHN4luNpc). + ## When Security Dashboards are updated The Security Dashboards show results of scans from the most recent completed pipeline on the diff --git a/doc/user/project/merge_requests/status_checks.md b/doc/user/project/merge_requests/status_checks.md index 4c806086fab..0e339c65ed5 100644 --- a/doc/user/project/merge_requests/status_checks.md +++ b/doc/user/project/merge_requests/status_checks.md @@ -71,7 +71,7 @@ using the API. You don't need to wait for a merge request webhook payload to be ## View the status checks on a project -Within each project's settings, you can see a list of status checks added to the project: +Within each project's settings, you can see a list of status check services added to the project: 1. In your project, go to **Settings > Merge requests** section. 1. Scroll down to **Status checks**. @@ -81,9 +81,9 @@ Within each project's settings, you can see a list of status checks added to the This list shows the service name, API URL, and targeted branch. It also provides actions to allow you to create, edit, or remove status checks. -## Add or update a status check +## Add or update a status check service -### Add a status check +### Add a status check service Within the **Status checks** sub-section, select the **Add status check** button. The **Add status check** form is then shown. @@ -92,7 +92,7 @@ The **Add status check** form is then shown. Filling in the form and selecting the **Add status check** button creates a new status check. -### Update a status check +### Update a status check service Within the **Status checks** sub-section, select the **Edit** button next to the status check you want to edit. @@ -135,7 +135,7 @@ for doesn't appear immediately. The search box requires If you want the status check to be applied to **all** merge requests, you can select the **All branches** option. -## Delete a status check +## Delete a status check service Within the **Status checks** sub-section, select the **Remove...** button next to the status check you want to delete. diff --git a/lib/banzai/reference_parser/commit_parser.rb b/lib/banzai/reference_parser/commit_parser.rb index 8ddb2bb8815..7c2bccc68d9 100644 --- a/lib/banzai/reference_parser/commit_parser.rb +++ b/lib/banzai/reference_parser/commit_parser.rb @@ -21,24 +21,6 @@ module Banzai end def find_commits(project, ids) - return limited_commits(project, ids) if Feature.enabled?(:limited_commit_parser, project) - - commits = [] - - return commits unless project.valid_repo? - - ids.each do |id| - commit = project.commit(id) - - commits << commit if commit - end - - commits - end - - private - - def limited_commits(project, ids) return [] unless project.valid_repo? ids = ids.take(COMMITS_LIMIT) @@ -46,6 +28,8 @@ module Banzai project.commits_by(oids: ids) end + private + def can_read_reference?(user, ref_project, node) can?(user, :download_code, ref_project) end diff --git a/lib/gitlab/github_import/clients/search_repos.rb b/lib/gitlab/github_import/clients/search_repos.rb index 5e058fc0933..a2ef6ca24eb 100644 --- a/lib/gitlab/github_import/clients/search_repos.rb +++ b/lib/gitlab/github_import/clients/search_repos.rb @@ -53,7 +53,7 @@ module Gitlab end def search_repos_query(string, options = {}) - base = "#{string} in:name is:public,private" + base = "#{string} in:name is:public,private fork:true" case options[:relation_type] when 'organization' then organization_repos_query(base, options) diff --git a/lib/sidebars/projects/menus/merge_requests_menu.rb b/lib/sidebars/projects/menus/merge_requests_menu.rb index be80a58d5f1..71cc53da3ea 100644 --- a/lib/sidebars/projects/menus/merge_requests_menu.rb +++ b/lib/sidebars/projects/menus/merge_requests_menu.rb @@ -60,9 +60,9 @@ module Sidebars override :active_routes def active_routes if context.project.issues_enabled? - { controller: 'projects/merge_requests' } + { controller: ['projects/merge_requests', :conflicts] } else - { controller: ['projects/merge_requests', :milestones] } + { controller: ['projects/merge_requests', :milestones, :conflicts] } end end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 5a87d2a1890..9848641e95e 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -27304,6 +27304,9 @@ msgstr "" msgid "Merge commit message" msgstr "" +msgid "Merge conflicts" +msgstr "" + msgid "Merge details" msgstr "" @@ -50745,7 +50748,7 @@ msgstr "" msgid "You can only transfer the project to namespaces you manage." msgstr "" -msgid "You can resolve the merge conflict using either the Interactive mode, by choosing %{use_ours} or %{use_theirs} buttons, or by editing the files directly. Commit these changes into %{branch_name}" +msgid "You can resolve the merge conflict using either the Interactive mode, by choosing %{use_ours} or %{use_theirs} buttons, or by editing the files directly. Commit these changes into %{branch_name}." msgstr "" msgid "You can see your chat accounts." diff --git a/spec/lib/banzai/reference_parser/commit_parser_spec.rb b/spec/lib/banzai/reference_parser/commit_parser_spec.rb index 9ed6235b8dd..7a1eed2e35e 100644 --- a/spec/lib/banzai/reference_parser/commit_parser_spec.rb +++ b/spec/lib/banzai/reference_parser/commit_parser_spec.rb @@ -154,28 +154,6 @@ RSpec.describe Banzai::ReferenceParser::CommitParser, feature_category: :source_ "b83d6e391c22777fca1ed3012fce84f633d7fed0" ]) end - - context 'when limited_commit_parser feature flag disabled' do - before do - stub_feature_flags(limited_commit_parser: false) - end - - it 'returns an Array of commit objects' do - commit = double(:commit) - - expect(project).to receive(:commit).with('123').and_return(commit) - expect(project).to receive(:valid_repo?).and_return(true) - - expect(subject.find_commits(project, %w{123})).to eq([commit]) - end - - it 'skips commit IDs for which no commit could be found' do - expect(project).to receive(:commit).with('123').and_return(nil) - expect(project).to receive(:valid_repo?).and_return(true) - - expect(subject.find_commits(project, %w{123})).to eq([]) - end - end end context 'when checking commits on another projects', :request_store do diff --git a/spec/lib/gitlab/github_import/client_spec.rb b/spec/lib/gitlab/github_import/client_spec.rb index e37b27aeaef..aa1205663e1 100644 --- a/spec/lib/gitlab/github_import/client_spec.rb +++ b/spec/lib/gitlab/github_import/client_spec.rb @@ -580,7 +580,10 @@ RSpec.describe Gitlab::GithubImport::Client, feature_category: :importers do end describe '#search_repos_by_name_graphql' do - let(:expected_query) { 'test in:name is:public,private user:user repo:repo1 repo:repo2 org:org1 org:org2' } + let(:expected_query) do + 'test in:name is:public,private fork:true user:user repo:repo1 repo:repo2 org:org1 org:org2' + end + let(:expected_graphql_params) { "type: REPOSITORY, query: \"#{expected_query}\"" } let(:expected_graphql) do <<-TEXT @@ -617,7 +620,7 @@ RSpec.describe Gitlab::GithubImport::Client, feature_category: :importers do context 'when relation type option present' do context 'when relation type is owned' do - let(:expected_query) { 'test in:name is:public,private user:user' } + let(:expected_query) { 'test in:name is:public,private fork:true user:user' } it 'searches for repositories within the organization based on name' do expect(client.octokit).to receive(:post).with( @@ -629,7 +632,7 @@ RSpec.describe Gitlab::GithubImport::Client, feature_category: :importers do end context 'when relation type is organization' do - let(:expected_query) { 'test in:name is:public,private org:test-login' } + let(:expected_query) { 'test in:name is:public,private fork:true org:test-login' } it 'searches for repositories within the organization based on name' do expect(client.octokit).to receive(:post).with( @@ -643,7 +646,7 @@ RSpec.describe Gitlab::GithubImport::Client, feature_category: :importers do end context 'when relation type is collaborated' do - let(:expected_query) { 'test in:name is:public,private repo:repo1 repo:repo2' } + let(:expected_query) { 'test in:name is:public,private fork:true repo:repo1 repo:repo2' } it 'searches for collaborated repositories based on name' do expect(client.octokit).to receive(:post).with( @@ -710,8 +713,8 @@ RSpec.describe Gitlab::GithubImport::Client, feature_category: :importers do describe '#count_repos_by_relation_type_graphql' do relation_types = { - 'owned' => ' in:name is:public,private user:user', - 'collaborated' => ' in:name is:public,private repo:repo1 repo:repo2', + 'owned' => ' in:name is:public,private fork:true user:user', + 'collaborated' => ' in:name is:public,private fork:true repo:repo1 repo:repo2', 'organization' => 'org:org1 org:org2' }