diff options
39 files changed, 321 insertions, 162 deletions
diff --git a/.gitlab/ci/review-apps/main.gitlab-ci.yml b/.gitlab/ci/review-apps/main.gitlab-ci.yml index a1378629270..a4d8d8672bb 100644 --- a/.gitlab/ci/review-apps/main.gitlab-ci.yml +++ b/.gitlab/ci/review-apps/main.gitlab-ci.yml @@ -67,7 +67,7 @@ review-build-cng: GITLAB_IMAGE_REPOSITORY: "registry.gitlab.com/gitlab-org/build/cng-mirror" GITLAB_IMAGE_SUFFIX: "ee" GITLAB_REVIEW_APP_BASE_CONFIG_FILE: "scripts/review_apps/base-config.yaml" - GITLAB_HELM_CHART_REF: "db886740f66e8dfacd7b9f0f79f640c8c2e0318a" # 7.5.1: https://gitlab.com/gitlab-org/charts/gitlab/-/commit/db886740f66e8dfacd7b9f0f79f640c8c2e0318a + GITLAB_HELM_CHART_REF: "eace227d3465e17e37b1a2e3764dd244c8e2d716" # 7.6.1: https://gitlab.com/gitlab-org/charts/gitlab/-/commit/eace227d3465e17e37b1a2e3764dd244c8e2d716 environment: name: review/${CI_COMMIT_REF_SLUG}${SCHEDULE_TYPE} # No separator for SCHEDULE_TYPE so it's compatible as before and looks nice without it url: https://gitlab-${CI_ENVIRONMENT_SLUG}.${REVIEW_APPS_DOMAIN} diff --git a/app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue b/app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue index acf84863f15..3a0fd376d3c 100644 --- a/app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue +++ b/app/assets/javascripts/ci/artifacts/components/job_artifacts_table.vue @@ -40,7 +40,6 @@ import { I18N_BULK_DELETE_ERROR, I18N_BULK_DELETE_PARTIAL_ERROR, I18N_BULK_DELETE_CONFIRMATION_TOAST, - SELECTED_ARTIFACTS_MAX_COUNT, I18N_BULK_DELETE_MAX_SELECTED, } from '../constants'; import JobCheckbox from './job_checkbox.vue'; @@ -77,7 +76,7 @@ export default { directives: { GlTooltip: GlTooltipDirective, }, - inject: ['projectId', 'projectPath', 'canDestroyArtifacts'], + inject: ['projectId', 'projectPath', 'canDestroyArtifacts', 'jobArtifactsCountLimit'], apollo: { jobArtifacts: { query: getJobArtifactsQuery, @@ -151,7 +150,7 @@ export default { return Boolean(this.selectedArtifacts.length); }, isSelectedArtifactsLimitReached() { - return this.selectedArtifacts.length >= SELECTED_ARTIFACTS_MAX_COUNT; + return this.selectedArtifacts.length >= this.jobArtifactsCountLimit; }, canBulkDestroyArtifacts() { return this.canDestroyArtifacts; diff --git a/app/assets/javascripts/ci/artifacts/constants.js b/app/assets/javascripts/ci/artifacts/constants.js index 28c371cda1e..166946035d1 100644 --- a/app/assets/javascripts/ci/artifacts/constants.js +++ b/app/assets/javascripts/ci/artifacts/constants.js @@ -47,7 +47,6 @@ export const I18N_MODAL_BODY = s__( export const I18N_MODAL_PRIMARY = s__('Artifacts|Delete artifact'); export const I18N_MODAL_CANCEL = __('Cancel'); -export const SELECTED_ARTIFACTS_MAX_COUNT = 50; export const I18N_BULK_DELETE_MAX_SELECTED = s__( 'Artifacts|Maximum selected artifacts limit reached', ); diff --git a/app/assets/javascripts/ci/artifacts/index.js b/app/assets/javascripts/ci/artifacts/index.js index c6021eb056f..0a84b94f5fa 100644 --- a/app/assets/javascripts/ci/artifacts/index.js +++ b/app/assets/javascripts/ci/artifacts/index.js @@ -19,7 +19,7 @@ export const initArtifactsTable = () => { return false; } - const { projectPath, projectId, canDestroyArtifacts } = el.dataset; + const { projectPath, projectId, canDestroyArtifacts, jobArtifactsCountLimit } = el.dataset; return new Vue({ el, @@ -28,6 +28,7 @@ export const initArtifactsTable = () => { projectPath, projectId, canDestroyArtifacts: parseBoolean(canDestroyArtifacts), + jobArtifactsCountLimit: parseInt(jobArtifactsCountLimit, 10), }, render: (createElement) => createElement(App), }); diff --git a/app/controllers/explore/catalog_controller.rb b/app/controllers/explore/catalog_controller.rb index 0c78c1fbdb8..4bcddf367b2 100644 --- a/app/controllers/explore/catalog_controller.rb +++ b/app/controllers/explore/catalog_controller.rb @@ -2,8 +2,11 @@ module Explore class CatalogController < Explore::ApplicationController + include ProductAnalyticsTracking + feature_category :pipeline_composition before_action :check_resource_access, only: :show + track_internal_event :index, name: 'unique_users_visiting_ci_catalog' def show; end @@ -20,5 +23,13 @@ module Explore def catalog_resource ::Ci::Catalog::Listing.new(current_user).find_resource(full_path: params[:full_path]) end + + def tracking_namespace_source + current_user.namespace + end + + def tracking_project_source + nil + end end end diff --git a/app/helpers/artifacts_helper.rb b/app/helpers/artifacts_helper.rb index 10d2714840d..3f23eacdcbb 100644 --- a/app/helpers/artifacts_helper.rb +++ b/app/helpers/artifacts_helper.rb @@ -5,7 +5,8 @@ module ArtifactsHelper { project_path: project.full_path, project_id: project.id, - can_destroy_artifacts: can?(current_user, :destroy_artifacts, project).to_s + can_destroy_artifacts: can?(current_user, :destroy_artifacts, project).to_s, + job_artifacts_count_limit: ::Ci::JobArtifacts::BulkDeleteByProjectService::JOB_ARTIFACTS_COUNT_LIMIT } end end diff --git a/app/models/ci/catalog/resources/sync_event.rb b/app/models/ci/catalog/resources/sync_event.rb index 2a452e6cc65..8783d023023 100644 --- a/app/models/ci/catalog/resources/sync_event.rb +++ b/app/models/ci/catalog/resources/sync_event.rb @@ -58,8 +58,6 @@ module Ci end def enqueue_worker - return unless Feature.enabled?(:ci_process_catalog_resource_sync_events) - ::Ci::Catalog::Resources::ProcessSyncEventsWorker.perform_async # rubocop:disable CodeReuse/Worker -- Worker is scheduled in model callback functions end diff --git a/app/models/project.rb b/app/models/project.rb index 35e38cd37d1..7b996457c0d 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -551,6 +551,7 @@ class Project < ApplicationRecord delegate :show_default_award_emojis, :show_default_award_emojis= delegate :enforce_auth_checks_on_uploads, :enforce_auth_checks_on_uploads= delegate :warn_about_potentially_unwanted_characters, :warn_about_potentially_unwanted_characters= + delegate :code_suggestions, :code_suggestions= end end @@ -3199,6 +3200,11 @@ class Project < ApplicationRecord end strong_memoize_attr :instance_runner_running_jobs_count + def code_suggestions_enabled? + code_suggestions && (group.nil? || group.code_suggestions) + end + strong_memoize_attr :code_suggestions_enabled? + private # overridden in EE @@ -3470,8 +3476,6 @@ class Project < ApplicationRecord # Catalog resource SyncEvents are created by PG triggers def enqueue_catalog_resource_sync_event_worker - catalog_resource.sync_with_project! if Feature.disabled?(:ci_process_catalog_resource_sync_events) - run_after_commit do ::Ci::Catalog::Resources::SyncEvent.enqueue_worker end diff --git a/app/models/project_setting.rb b/app/models/project_setting.rb index f684feacace..e3ffe2347d8 100644 --- a/app/models/project_setting.rb +++ b/app/models/project_setting.rb @@ -39,6 +39,7 @@ class ProjectSetting < ApplicationRecord validates :issue_branch_template, length: { maximum: Issue::MAX_BRANCH_TEMPLATE } validates :target_platforms, inclusion: { in: ALLOWED_TARGET_PLATFORMS } validates :suggested_reviewers_enabled, inclusion: { in: [true, false] } + validates :code_suggestions, allow_nil: false, inclusion: { in: [true, false] } validates :pages_unique_domain, uniqueness: { if: -> { pages_unique_domain.present? } }, diff --git a/app/services/ci/job_artifacts/bulk_delete_by_project_service.rb b/app/services/ci/job_artifacts/bulk_delete_by_project_service.rb index 738fa19e29b..57f65f6dea3 100644 --- a/app/services/ci/job_artifacts/bulk_delete_by_project_service.rb +++ b/app/services/ci/job_artifacts/bulk_delete_by_project_service.rb @@ -5,7 +5,7 @@ module Ci class BulkDeleteByProjectService include BaseServiceUtility - JOB_ARTIFACTS_COUNT_LIMIT = 50 + JOB_ARTIFACTS_COUNT_LIMIT = 100 def initialize(job_artifact_ids:, project:, current_user:) @job_artifact_ids = job_artifact_ids diff --git a/app/workers/ci/catalog/resources/process_sync_events_worker.rb b/app/workers/ci/catalog/resources/process_sync_events_worker.rb index 10a3e4f0a35..15e06393aff 100644 --- a/app/workers/ci/catalog/resources/process_sync_events_worker.rb +++ b/app/workers/ci/catalog/resources/process_sync_events_worker.rb @@ -27,8 +27,6 @@ module Ci deduplicate :until_executed, if_deduplicated: :reschedule_once, ttl: 1.minute def perform - return if Feature.disabled?(:ci_process_catalog_resource_sync_events) - results = ::Ci::ProcessSyncEventsService.new( ::Ci::Catalog::Resources::SyncEvent, ::Ci::Catalog::Resource ).execute diff --git a/config/events/unique_users_visiting_ci_catalog.yml b/config/events/unique_users_visiting_ci_catalog.yml new file mode 100644 index 00000000000..f6abc839688 --- /dev/null +++ b/config/events/unique_users_visiting_ci_catalog.yml @@ -0,0 +1,24 @@ +--- +description: Unique self managed and .com users visiting CI/CD Catalog page count on monthly and weekly basis. +category: InternalEventTracking +action: unique_users_visiting_ci_catalog +label_description: +property_description: +value_description: +extra_properties: +identifiers: +product_section: ops +product_stage: verify +product_group: pipeline_authoring +milestone: "16.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137564 +distributions: +- ce +- ee +tiers: +- free +- premium +- ultimate +events: + - name: unique_users_visiting_ci_catalog + unique: user.id diff --git a/config/feature_flags/development/ci_process_catalog_resource_sync_events.yml b/config/feature_flags/development/ci_process_catalog_resource_sync_events.yml deleted file mode 100644 index 374ccc4409a..00000000000 --- a/config/feature_flags/development/ci_process_catalog_resource_sync_events.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: ci_process_catalog_resource_sync_events -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137238 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/432963 -milestone: '16.7' -type: development -group: group::pipeline authoring -default_enabled: false diff --git a/config/metrics/counts_28d/count_distinct_user_id_from_unique_users_visiting_ci_catalog_28d.yml b/config/metrics/counts_28d/count_distinct_user_id_from_unique_users_visiting_ci_catalog_28d.yml new file mode 100644 index 00000000000..45e3b6fdb8c --- /dev/null +++ b/config/metrics/counts_28d/count_distinct_user_id_from_unique_users_visiting_ci_catalog_28d.yml @@ -0,0 +1,28 @@ +--- +key_path: redis_hll_counters.pipeline_authoring.unique_users_visiting_ci_catalog_monthly +description: Unique self managed and .com users visiting CI/CD Catalog page monthly count. +product_section: ops +product_stage: verify +product_group: pipeline_authoring +performance_indicator_type: [] +value_type: number +status: active +milestone: "16.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137564 +time_frame: 28d +data_source: internal_events +data_category: optional +instrumentation_class: RedisHLLMetric +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +options: + events: + - unique_users_visiting_ci_catalog +events: + - name: unique_users_visiting_ci_catalog + unique: user.id diff --git a/config/metrics/counts_7d/20211126090002_p_analytics_ci_cd_deployment_frequency.yml b/config/metrics/counts_7d/20211126090002_p_analytics_ci_cd_deployment_frequency.yml index a7d8d75e23f..728ec39bada 100644 --- a/config/metrics/counts_7d/20211126090002_p_analytics_ci_cd_deployment_frequency.yml +++ b/config/metrics/counts_7d/20211126090002_p_analytics_ci_cd_deployment_frequency.yml @@ -6,7 +6,7 @@ product_section: dev product_stage: manage product_group: optimize value_type: number -status: active +status: removed milestone: '14.6' introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/75187 time_frame: 7d @@ -22,3 +22,5 @@ tier: - free - premium - ultimate +removed_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139231 +milestone_removed: '16.7' diff --git a/config/metrics/counts_7d/count_distinct_user_id_from_unique_users_visiting_ci_catalog_7d.yml b/config/metrics/counts_7d/count_distinct_user_id_from_unique_users_visiting_ci_catalog_7d.yml new file mode 100644 index 00000000000..1709265b9ce --- /dev/null +++ b/config/metrics/counts_7d/count_distinct_user_id_from_unique_users_visiting_ci_catalog_7d.yml @@ -0,0 +1,28 @@ +--- +key_path: redis_hll_counters.pipeline_authoring.unique_users_visiting_ci_catalog_weekly +description: Unique self managed and .com users visiting CI/CD Catalog page weekly count. +product_section: ops +product_stage: verify +product_group: pipeline_authoring +performance_indicator_type: [] +value_type: number +status: active +milestone: "16.7" +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137564 +time_frame: 7d +data_source: internal_events +data_category: optional +instrumentation_class: RedisHLLMetric +distribution: +- ce +- ee +tier: +- free +- premium +- ultimate +options: + events: + - unique_users_visiting_ci_catalog +events: + - name: unique_users_visiting_ci_catalog + unique: user.id diff --git a/db/docs/batched_background_migrations/backfill_project_wiki_repositories.yml b/db/docs/batched_background_migrations/backfill_project_wiki_repositories.yml index 3aaeee19c73..4d55cad0f5a 100644 --- a/db/docs/batched_background_migrations/backfill_project_wiki_repositories.yml +++ b/db/docs/batched_background_migrations/backfill_project_wiki_repositories.yml @@ -1,8 +1,8 @@ --- migration_job_name: BackfillProjectWikiRepositories -description: >- - Backfills the project_wiki_repositories table for each project that still +description: Backfills the project_wiki_repositories table for each project that still does not have an entry in this table. feature_category: geo introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/113783 milestone: '15.10' +finalized_by: '20231207221013' diff --git a/db/docs/views/postgres_sequences.yml b/db/docs/views/postgres_sequences.yml new file mode 100644 index 00000000000..7937a5511bf --- /dev/null +++ b/db/docs/views/postgres_sequences.yml @@ -0,0 +1,10 @@ +--- +view_name: postgres_sequences +classes: + - Gitlab::Database::PostgresSequence +feature_categories: + - database +description: SQL view to get information about postgres sequences +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139117 +milestone: '16.7' +gitlab_schema: gitlab_shared diff --git a/db/migrate/20231205163658_add_code_suggestions_to_project_setting.rb b/db/migrate/20231205163658_add_code_suggestions_to_project_setting.rb new file mode 100644 index 00000000000..53c303963a5 --- /dev/null +++ b/db/migrate/20231205163658_add_code_suggestions_to_project_setting.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddCodeSuggestionsToProjectSetting < Gitlab::Database::Migration[2.2] + enable_lock_retries! + milestone '16.7' + + def change + add_column :project_settings, :code_suggestions, :boolean, default: true, null: false + end +end diff --git a/db/migrate/20231207144215_add_postgres_sequences_view.rb b/db/migrate/20231207144215_add_postgres_sequences_view.rb new file mode 100644 index 00000000000..6187bb5f15e --- /dev/null +++ b/db/migrate/20231207144215_add_postgres_sequences_view.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class AddPostgresSequencesView < Gitlab::Database::Migration[2.2] + milestone '16.7' + enable_lock_retries! + + def up + execute(<<~SQL) + CREATE OR REPLACE VIEW postgres_sequences + AS + SELECT seq_pg_class.relname AS seq_name, + dep_pg_class.relname AS table_name, + pg_attribute.attname AS col_name + FROM pg_class seq_pg_class + INNER JOIN pg_depend ON seq_pg_class.oid = pg_depend.objid + INNER JOIN pg_class dep_pg_class ON pg_depend.refobjid = dep_pg_class.oid + INNER JOIN pg_attribute ON dep_pg_class.oid = pg_attribute.attrelid + AND pg_depend.refobjsubid = pg_attribute.attnum + WHERE seq_pg_class.relkind = 'S' + SQL + end + + def down + execute(<<~SQL) + DROP VIEW postgres_sequences; + SQL + end +end diff --git a/db/post_migrate/20231207221013_finalize_backfill_project_wiki_repositories.rb b/db/post_migrate/20231207221013_finalize_backfill_project_wiki_repositories.rb new file mode 100644 index 00000000000..b26ff3645e3 --- /dev/null +++ b/db/post_migrate/20231207221013_finalize_backfill_project_wiki_repositories.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class FinalizeBackfillProjectWikiRepositories < Gitlab::Database::Migration[2.2] + milestone '16.7' + + disable_ddl_transaction! + + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + ensure_batched_background_migration_is_finished( + job_class_name: 'BackfillProjectWikiRepositories', + table_name: :projects, + column_name: :id, + job_arguments: [], + finalize: true + ) + end + + def down; end +end diff --git a/db/schema_migrations/20231205163658 b/db/schema_migrations/20231205163658 new file mode 100644 index 00000000000..c2ecfa8486b --- /dev/null +++ b/db/schema_migrations/20231205163658 @@ -0,0 +1 @@ +94118057fe8e0d4ed9ac6590e3aa48088f26524f02dead72f338ff58c078ef33
\ No newline at end of file diff --git a/db/schema_migrations/20231207144215 b/db/schema_migrations/20231207144215 new file mode 100644 index 00000000000..971d4918577 --- /dev/null +++ b/db/schema_migrations/20231207144215 @@ -0,0 +1 @@ +871cc15f04f235ff2719eb334c28041a0f1093653e5ca2fad5e92b911622d221
\ No newline at end of file diff --git a/db/schema_migrations/20231207221013 b/db/schema_migrations/20231207221013 new file mode 100644 index 00000000000..fad9a767d63 --- /dev/null +++ b/db/schema_migrations/20231207221013 @@ -0,0 +1 @@ +a070e5c7b51853b44fc3402de428cff14c0ad2728dd2f24fef542e86a51da2d3
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 3e55c8ff615..b855817e6a9 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -21617,6 +21617,16 @@ CREATE SEQUENCE postgres_reindex_queued_actions_id_seq ALTER SEQUENCE postgres_reindex_queued_actions_id_seq OWNED BY postgres_reindex_queued_actions.id; +CREATE VIEW postgres_sequences AS + SELECT seq_pg_class.relname AS seq_name, + dep_pg_class.relname AS table_name, + pg_attribute.attname AS col_name + FROM (((pg_class seq_pg_class + JOIN pg_depend ON ((seq_pg_class.oid = pg_depend.objid))) + JOIN pg_class dep_pg_class ON ((pg_depend.refobjid = dep_pg_class.oid))) + JOIN pg_attribute ON (((dep_pg_class.oid = pg_attribute.attrelid) AND (pg_depend.refobjsubid = pg_attribute.attnum)))) + WHERE (seq_pg_class.relkind = 'S'::"char"); + CREATE TABLE programming_languages ( id integer NOT NULL, name character varying NOT NULL, @@ -22200,6 +22210,7 @@ CREATE TABLE project_settings ( encrypted_product_analytics_configurator_connection_string_iv bytea, pages_multiple_versions_enabled boolean DEFAULT false NOT NULL, allow_merge_without_pipeline boolean DEFAULT false NOT NULL, + code_suggestions boolean DEFAULT true NOT NULL, CONSTRAINT check_1a30456322 CHECK ((char_length(pages_unique_domain) <= 63)), CONSTRAINT check_3a03e7557a CHECK ((char_length(previous_default_branch) <= 4096)), CONSTRAINT check_3ca5cbffe6 CHECK ((char_length(issue_branch_template) <= 255)), diff --git a/doc/topics/git/troubleshooting_git.md b/doc/topics/git/troubleshooting_git.md index 27e80302d22..dd3a2efc11b 100644 --- a/doc/topics/git/troubleshooting_git.md +++ b/doc/topics/git/troubleshooting_git.md @@ -10,6 +10,38 @@ Sometimes things don't work the way they should or as you might expect when you're using Git. Here are some tips on troubleshooting and resolving issues with Git. +## Debugging + +When troubleshooting problems with Git, try these debugging techniques. + +### Use a custom SSH key for a Git command + +```shell +GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlabadmin" git <command> +``` + +### Debug problems with cloning + +For Git over SSH: + +```shell +GIT_SSH_COMMAND="ssh -vvv" git clone <git@url> +``` + +For Git over HTTPS: + +```shell +GIT_TRACE_PACKET=1 GIT_TRACE=2 GIT_CURL_VERBOSE=1 git clone <url> +``` + +### Debug Git with traces + +Git includes a complete set of [traces for debugging Git commands](https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_debugging), for example: + +- `GIT_TRACE_PERFORMANCE=1`: enables tracing of performance data, showing how long each particular `git` invocation takes. +- `GIT_TRACE_SETUP=1`: enables tracing of what `git` is discovering about the repository and environment it's interacting with. +- `GIT_TRACE_PACKET=1`: enables packet-level tracing for network operations. + ## Broken pipe errors on `git push` 'Broken pipe' errors can occur when attempting to push to a remote repository. diff --git a/doc/topics/git/useful_git_commands.md b/doc/topics/git/useful_git_commands.md index 09705f006ae..a397ec749d0 100644 --- a/doc/topics/git/useful_git_commands.md +++ b/doc/topics/git/useful_git_commands.md @@ -57,36 +57,6 @@ gitk <file> gitk --follow <file> ``` -## Debugging - -### Use a custom SSH key for a Git command - -```shell -GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlabadmin" git <command> -``` - -### Debug cloning - -With SSH: - -```shell -GIT_SSH_COMMAND="ssh -vvv" git clone <git@url> -``` - -With HTTPS: - -```shell -GIT_TRACE_PACKET=1 GIT_TRACE=2 GIT_CURL_VERBOSE=1 git clone <url> -``` - -### Debugging with Git embedded traces - -Git includes a complete set of [traces for debugging Git commands](https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables#_debugging), for example: - -- `GIT_TRACE_PERFORMANCE=1`: enables tracing of performance data, showing how long each particular `git` invocation takes. -- `GIT_TRACE_SETUP=1`: enables tracing of what `git` is discovering about the repository and environment it's interacting with. -- `GIT_TRACE_PACKET=1`: enables packet-level tracing for network operations. - ## Rebasing ### Rebase your branch onto the default diff --git a/doc/user/permissions.md b/doc/user/permissions.md index f2a4562c523..da4212ffcaf 100644 --- a/doc/user/permissions.md +++ b/doc/user/permissions.md @@ -121,7 +121,7 @@ The following table lists project permissions available for each role: | [License Scanning](compliance/license_scanning_of_cyclonedx_files/index.md):<br>View License Compliance reports | ✓ (1) | ✓ | ✓ | ✓ | ✓ | | [License Scanning](compliance/license_scanning_of_cyclonedx_files/index.md):<br>View License list | | ✓ | ✓ | ✓ | ✓ | | [License approval policies](../user/compliance/license_approval_policies.md):<br>Manage license policy | | | | ✓ | ✓ | -| [Merge requests](project/merge_requests/index.md):<br>Assign reviewer | | ✓ | ✓ | ✓ | ✓ | +| [Merge requests](project/merge_requests/index.md):<br>Assign reviewer | | | ✓ | ✓ | ✓ | | [Merge requests](project/merge_requests/index.md):<br>View list | (25) | ✓ | ✓ | ✓ | ✓ | | [Merge requests](project/merge_requests/index.md):<br>Apply code change suggestions | | | ✓ | ✓ | ✓ | | [Merge requests](project/merge_requests/index.md):<br>Approve (8) | | | ✓ | ✓ | ✓ | diff --git a/lib/api/entities/project.rb b/lib/api/entities/project.rb index af93e09ef0d..0012fcf957b 100644 --- a/lib/api/entities/project.rb +++ b/lib/api/entities/project.rb @@ -41,6 +41,7 @@ module API end end + expose :code_suggestions, documentation: { type: 'boolean' } expose :packages_enabled, documentation: { type: 'boolean' } expose :empty_repo?, as: :empty_repo, documentation: { type: 'boolean' } expose :archived?, as: :archived, documentation: { type: 'boolean' } diff --git a/lib/gitlab/database/postgres_sequence.rb b/lib/gitlab/database/postgres_sequence.rb new file mode 100644 index 00000000000..bf394d80e12 --- /dev/null +++ b/lib/gitlab/database/postgres_sequence.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Gitlab + module Database + # Backed by the postgres_sequences view + class PostgresSequence < SharedModel + self.primary_key = :seq_name + + scope :by_table_name, ->(table_name) { where(table_name: table_name) } + end + end +end diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index 4da7dcba763..a2848bd0256 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -608,4 +608,16 @@ FactoryBot.define do path { 'gitlab-profile' } files { { 'README.md' => 'Hello World' } } end + + trait :with_code_suggestions_enabled do + after(:create) do |project| + project.project_setting.update!(code_suggestions: true) + end + end + + trait :with_code_suggestions_disabled do + after(:create) do |project| + project.project_setting.update!(code_suggestions: false) + end + end end diff --git a/spec/frontend/ci/artifacts/components/job_artifacts_table_spec.js b/spec/frontend/ci/artifacts/components/job_artifacts_table_spec.js index d44886a4f95..36f27d1781e 100644 --- a/spec/frontend/ci/artifacts/components/job_artifacts_table_spec.js +++ b/spec/frontend/ci/artifacts/components/job_artifacts_table_spec.js @@ -22,11 +22,12 @@ import { I18N_FETCH_ERROR, INITIAL_CURRENT_PAGE, I18N_BULK_DELETE_ERROR, - SELECTED_ARTIFACTS_MAX_COUNT, } from '~/ci/artifacts/constants'; import { totalArtifactsSizeForJob } from '~/ci/artifacts/utils'; import { createAlert } from '~/alert'; +const jobArtifactsCountLimit = 100; + jest.mock('~/alert'); Vue.use(VueApollo); @@ -127,10 +128,10 @@ describe('JobArtifactsTable component', () => { .map((jobNode) => jobNode.artifacts.nodes.map((artifactNode) => artifactNode.id)) .reduce((artifacts, jobArtifacts) => artifacts.concat(jobArtifacts)); - const maxSelectedArtifacts = new Array(SELECTED_ARTIFACTS_MAX_COUNT).fill('artifact-id'); + const maxSelectedArtifacts = new Array(jobArtifactsCountLimit).fill('artifact-id'); const maxSelectedArtifactsIncludingCurrentPage = [ ...allArtifacts, - ...new Array(SELECTED_ARTIFACTS_MAX_COUNT - allArtifacts.length).fill('artifact-id'), + ...new Array(jobArtifactsCountLimit - allArtifacts.length).fill('artifact-id'), ]; const createComponent = ({ @@ -151,6 +152,7 @@ describe('JobArtifactsTable component', () => { projectPath: 'project/path', projectId, canDestroyArtifacts, + jobArtifactsCountLimit, }, mocks: { $toast: { @@ -665,7 +667,7 @@ describe('JobArtifactsTable component', () => { describe('select all checkbox respects selected artifacts limit', () => { describe('when selecting all visible artifacts would exceed the limit', () => { - const selectedArtifactsLength = SELECTED_ARTIFACTS_MAX_COUNT - 1; + const selectedArtifactsLength = jobArtifactsCountLimit - 1; beforeEach(async () => { createComponent({ @@ -687,9 +689,7 @@ describe('JobArtifactsTable component', () => { await nextTick(); expect(findSelectAllCheckboxChecked()).toBe(true); - expect(findBulkDelete().props('selectedArtifacts')).toHaveLength( - SELECTED_ARTIFACTS_MAX_COUNT, - ); + expect(findBulkDelete().props('selectedArtifacts')).toHaveLength(jobArtifactsCountLimit); expect(findBulkDelete().props('selectedArtifacts')).not.toContain( allArtifacts[allArtifacts.length - 1], ); @@ -748,7 +748,7 @@ describe('JobArtifactsTable component', () => { it('deselects all artifacts when toggled', async () => { expect(findBulkDelete().props('selectedArtifacts')).toHaveLength( - SELECTED_ARTIFACTS_MAX_COUNT, + jobArtifactsCountLimit, ); toggleSelectAllCheckbox(); @@ -757,7 +757,7 @@ describe('JobArtifactsTable component', () => { expect(findSelectAllCheckboxChecked()).toBe(false); expect(findBulkDelete().props('selectedArtifacts')).toHaveLength( - SELECTED_ARTIFACTS_MAX_COUNT - allArtifacts.length, + jobArtifactsCountLimit - allArtifacts.length, ); }); }); diff --git a/spec/helpers/artifacts_helper_spec.rb b/spec/helpers/artifacts_helper_spec.rb index 30f9421954e..ed400ad4111 100644 --- a/spec/helpers/artifacts_helper_spec.rb +++ b/spec/helpers/artifacts_helper_spec.rb @@ -17,7 +17,8 @@ RSpec.describe ArtifactsHelper, feature_category: :build_artifacts do it 'returns expected data' do expect(subject).to include({ project_path: project.full_path, - project_id: project.id + project_id: project.id, + job_artifacts_count_limit: 100 }) end diff --git a/spec/lib/gitlab/database/postgres_sequences_spec.rb b/spec/lib/gitlab/database/postgres_sequences_spec.rb new file mode 100644 index 00000000000..2373edaea18 --- /dev/null +++ b/spec/lib/gitlab/database/postgres_sequences_spec.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::Database::PostgresSequence, type: :model, feature_category: :database do + # PostgresSequence does not `behaves_like 'a postgres model'` because it does not correspond 1-1 with a single entry + # in pg_class + let(:schema) { ActiveRecord::Base.connection.current_schema } + let(:table_name) { '_test_table' } + let(:table_name_without_sequence) { '_test_table_without_sequence' } + + before do + ActiveRecord::Base.connection.execute(<<~SQL) + CREATE TABLE #{table_name} ( + id bigserial PRIMARY KEY NOT NULL + ); + + CREATE TABLE #{table_name_without_sequence} ( + id bigint PRIMARY KEY NOT NULL + ); + SQL + end + + describe '#by_table_name' do + context 'when table does not have a sequence' do + it 'returns an empty collection' do + expect(described_class.by_table_name(table_name_without_sequence)).to be_empty + end + end + + it 'returns the sequence for a given table' do + expect(described_class.by_table_name(table_name).first[:table_name]).to eq(table_name) + end + end +end diff --git a/spec/models/ci/catalog/resource_spec.rb b/spec/models/ci/catalog/resource_spec.rb index 047ba135cd5..8ed7369e3d7 100644 --- a/spec/models/ci/catalog/resource_spec.rb +++ b/spec/models/ci/catalog/resource_spec.rb @@ -212,53 +212,6 @@ RSpec.describe Ci::Catalog::Resource, feature_category: :pipeline_composition do end end end - - context 'when FF `ci_process_catalog_resource_sync_events` is disabled' do - before do - stub_feature_flags(ci_process_catalog_resource_sync_events: false) - end - - context 'when the catalog resource is created' do - let(:resource) { build(:ci_catalog_resource, project: project) } - - it 'updates the catalog resource columns to match the project' do - resource.save! - resource.reload - - expect(resource.name).to eq(project.name) - expect(resource.description).to eq(project.description) - expect(resource.visibility_level).to eq(project.visibility_level) - end - end - - context 'when the project is updated' do - let_it_be(:resource) { create(:ci_catalog_resource, project: project) } - - context 'when project name is updated' do - it 'updates the catalog resource name to match' do - project.update!(name: 'New name') - - expect(resource.reload.name).to eq(project.name) - end - end - - context 'when project description is updated' do - it 'updates the catalog resource description to match' do - project.update!(description: 'New description') - - expect(resource.reload.description).to eq(project.description) - end - end - - context 'when project visibility_level is updated' do - it 'updates the catalog resource visibility_level to match' do - project.update!(visibility_level: Gitlab::VisibilityLevel::INTERNAL) - - expect(resource.reload.visibility_level).to eq(project.visibility_level) - end - end - end - end end describe '#update_latest_released_at! triggered in model callbacks' do diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index a58856afe02..c256c4f10f8 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -8956,21 +8956,6 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr project.update!(path: 'path') end end - - context 'when FF `ci_process_catalog_resource_sync_events` is disabled' do - before do - stub_feature_flags(ci_process_catalog_resource_sync_events: false) - end - - it 'does not enqueue Ci::Catalog::Resources::ProcessSyncEventsWorker' do - expect(Ci::Catalog::Resources::ProcessSyncEventsWorker).not_to receive(:perform_async) - - project.update!( - name: 'New name', - description: 'New description', - visibility_level: Gitlab::VisibilityLevel::INTERNAL) - end - end end context 'when the project does not have a catalog resource' do diff --git a/spec/requests/explore/catalog_controller_spec.rb b/spec/requests/explore/catalog_controller_spec.rb index 051379c9641..e75b0bba5a6 100644 --- a/spec/requests/explore/catalog_controller_spec.rb +++ b/spec/requests/explore/catalog_controller_spec.rb @@ -3,7 +3,10 @@ require 'spec_helper' RSpec.describe Explore::CatalogController, feature_category: :pipeline_composition do - let_it_be(:catalog_resource) { create(:ci_catalog_resource, state: :published) } + let_it_be(:namespace) { create(:group) } + let_it_be(:project) { create(:project, namespace: namespace) } + let_it_be(:catalog_resource) { create(:ci_catalog_resource, :published, project: project) } + let_it_be(:user) { create(:user) } before_all do @@ -34,17 +37,33 @@ RSpec.describe Explore::CatalogController, feature_category: :pipeline_compositi it_behaves_like 'basic get requests', :show context 'when rendering a draft catalog resource' do - it 'responds with 404' do - catalog_resource = create(:ci_catalog_resource, state: :draft) + it 'returns not found error' do + draft_catalog_resource = create(:ci_catalog_resource, state: :draft) - get explore_catalog_path(catalog_resource) + get explore_catalog_path(draft_catalog_resource) expect(response).to have_gitlab_http_status(:not_found) end end + + context 'when rendering a published catalog resource' do + it 'returns success response' do + get explore_catalog_path(catalog_resource) + + expect(response).to have_gitlab_http_status(:success) + end + end end describe 'GET #index' do + let(:subject) { get explore_catalog_index_path } + it_behaves_like 'basic get requests', :index + + it_behaves_like 'internal event tracking' do + let(:namespace) { user.namespace } + let(:project) { nil } + let(:event) { 'unique_users_visiting_ci_catalog' } + end end end diff --git a/spec/services/ci/process_sync_events_service_spec.rb b/spec/services/ci/process_sync_events_service_spec.rb index 48b70eb38c9..cea5eec294e 100644 --- a/spec/services/ci/process_sync_events_service_spec.rb +++ b/spec/services/ci/process_sync_events_service_spec.rb @@ -212,20 +212,6 @@ RSpec.describe Ci::ProcessSyncEventsService, feature_category: :continuous_integ execute end - - context 'when FF `ci_process_catalog_resource_sync_events` is disabled' do - before do - stub_feature_flags(ci_process_catalog_resource_sync_events: false) - end - - it 'does not enqueue Ci::Catalog::Resources::ProcessSyncEventsWorker' do - stub_const("#{described_class}::BATCH_SIZE", 1) - - expect(Ci::Catalog::Resources::ProcessSyncEventsWorker).not_to receive(:perform_async) - - execute - end - end end # The `p_catalog_resource_sync_events` table does not enforce an FK on catalog_resource_id diff --git a/spec/workers/ci/catalog/resources/process_sync_events_worker_spec.rb b/spec/workers/ci/catalog/resources/process_sync_events_worker_spec.rb index fba8bb50a32..036cc54e9ba 100644 --- a/spec/workers/ci/catalog/resources/process_sync_events_worker_spec.rb +++ b/spec/workers/ci/catalog/resources/process_sync_events_worker_spec.rb @@ -48,21 +48,5 @@ RSpec.describe Ci::Catalog::Resources::ProcessSyncEventsWorker, feature_category perform end - - context 'when FF `ci_process_catalog_resource_sync_events` is disabled' do - before do - stub_feature_flags(ci_process_catalog_resource_sync_events: false) - end - - it 'does not process the sync events', :aggregate_failures do - expect(worker).not_to receive(:log_extra_metadata_on_done) - - expect { perform }.not_to change { Ci::Catalog::Resources::SyncEvent.status_pending.count } - - expect(resource.reload.name).to eq('Old Name') - expect(resource.reload.description).to be_nil - expect(resource.reload.visibility_level).to eq(Gitlab::VisibilityLevel::PRIVATE) - end - end end end |