diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-22 21:10:39 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-22 21:10:39 +0000 |
commit | e5356e229f5a1181d1a49091d6dc611db68bfffb (patch) | |
tree | 21ce5d5d251722ceae1f80e20d3c01a2b8833e7c | |
parent | b3c281c8c7109b3286a505d29330926e59139009 (diff) | |
download | gitlab-ce-e5356e229f5a1181d1a49091d6dc611db68bfffb.tar.gz |
Add latest changes from gitlab-org/gitlab@master
36 files changed, 354 insertions, 149 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue index 12f65a4c235..750014c599a 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue @@ -1,4 +1,5 @@ <script> +import { GlLoadingIcon } from '@gitlab/ui'; import autoMergeMixin from 'ee_else_ce/vue_merge_request_widget/mixins/auto_merge'; import { deprecatedCreateFlash as Flash } from '../../../flash'; import statusIcon from '../mr_widget_status_icon.vue'; @@ -12,6 +13,7 @@ export default { components: { MrWidgetAuthor, statusIcon, + GlLoadingIcon, }, mixins: [autoMergeMixin], props: { @@ -100,7 +102,7 @@ export default { class="btn btn-sm btn-default js-cancel-auto-merge" @click.prevent="cancelAutomaticMerge" > - <i v-if="isCancellingAutoMerge" class="fa fa-spinner fa-spin" aria-hidden="true"> </i> + <gl-loading-icon v-if="isCancellingAutoMerge" inline class="gl-mr-1" /> {{ cancelButtonText }} </a> </h4> @@ -122,7 +124,7 @@ export default { href="#" @click.prevent="removeSourceBranch" > - <i v-if="isRemovingSourceBranch" class="fa fa-spinner fa-spin" aria-hidden="true"> </i> + <gl-loading-icon v-if="isRemovingSourceBranch" inline class="gl-mr-1" /> {{ s__('mrWidget|Delete source branch') }} </a> </p> diff --git a/app/views/projects/ci/lints/_create.html.haml b/app/views/projects/ci/lints/_create.html.haml index 4b7cda0ef57..8afa5c220ba 100644 --- a/app/views/projects/ci/lints/_create.html.haml +++ b/app/views/projects/ci/lints/_create.html.haml @@ -17,9 +17,9 @@ %tr %td #{job[:stage].capitalize} Job - #{job[:name]} %td - %pre= job[:before_script].to_a.join('\n') - %pre= job[:script].to_a.join('\n') - %pre= job[:after_script].to_a.join('\n') + %pre= job[:before_script].to_a.join('<br />') + %pre= job[:script].to_a.join('<br />') + %pre= job[:after_script].to_a.join('<br />') %br %b= _("Tag list:") = job[:tag_list].to_a.join(", ") diff --git a/changelogs/unreleased/202279-migrate-fa-spinner-to-spinner-for-app-assets-javascripts-vue_merge.yml b/changelogs/unreleased/202279-migrate-fa-spinner-to-spinner-for-app-assets-javascripts-vue_merge.yml new file mode 100644 index 00000000000..daec1de387b --- /dev/null +++ b/changelogs/unreleased/202279-migrate-fa-spinner-to-spinner-for-app-assets-javascripts-vue_merge.yml @@ -0,0 +1,5 @@ +--- +title: Update loading icon for buttons used in MR's set to merge automatically +merge_request: 45693 +author: +type: changed diff --git a/changelogs/unreleased/ab-primary-keys.yml b/changelogs/unreleased/ab-primary-keys.yml new file mode 100644 index 00000000000..ff1ca7aa794 --- /dev/null +++ b/changelogs/unreleased/ab-primary-keys.yml @@ -0,0 +1,5 @@ +--- +title: Specify primary key for tables without +merge_request: 45198 +author: +type: other diff --git a/changelogs/unreleased/fix-ci-lint-newlines.yml b/changelogs/unreleased/fix-ci-lint-newlines.yml new file mode 100644 index 00000000000..f137ab50033 --- /dev/null +++ b/changelogs/unreleased/fix-ci-lint-newlines.yml @@ -0,0 +1,5 @@ +--- +title: 'Render script newlines in CI Lint view' +merge_request: 45087 +author: Nejc Habjan +type: fixed diff --git a/db/migrate/20201014163633_specify_primary_key_where_missing.rb b/db/migrate/20201014163633_specify_primary_key_where_missing.rb new file mode 100644 index 00000000000..bca111dacf2 --- /dev/null +++ b/db/migrate/20201014163633_specify_primary_key_where_missing.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +class SpecifyPrimaryKeyWhereMissing < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + TABLES = { + project_authorizations: [:index_project_authorizations_on_user_id_project_id_access_level, %i(user_id project_id access_level)], + analytics_language_trend_repository_languages: [:analytics_repository_languages_unique_index, %i(programming_language_id project_id snapshot_date)], + approval_project_rules_protected_branches: [:index_approval_project_rules_protected_branches_unique, %i(approval_project_rule_id protected_branch_id)], + ci_build_trace_sections: [:index_ci_build_trace_sections_on_build_id_and_section_name_id, %i(build_id section_name_id)], + deployment_merge_requests: [:idx_deployment_merge_requests_unique_index, %i(deployment_id merge_request_id)], + issue_assignees: [:index_issue_assignees_on_issue_id_and_user_id, %i(issue_id user_id)], + issues_prometheus_alert_events: [:issue_id_prometheus_alert_event_id_index, %i(issue_id prometheus_alert_event_id)], + issues_self_managed_prometheus_alert_events: [:issue_id_self_managed_prometheus_alert_event_id_index, %i(issue_id self_managed_prometheus_alert_event_id)], + merge_request_diff_commits: [:index_merge_request_diff_commits_on_mr_diff_id_and_order, %i(merge_request_diff_id relative_order)], + merge_request_diff_files: [:index_merge_request_diff_files_on_mr_diff_id_and_order, %i(merge_request_diff_id relative_order)], + milestone_releases: [:index_miletone_releases_on_milestone_and_release, %i(milestone_id release_id)], + project_pages_metadata: [:index_project_pages_metadata_on_project_id, %i(project_id)], + push_event_payloads: [:index_push_event_payloads_on_event_id, %i(event_id)], + repository_languages: [:index_repository_languages_on_project_and_languages_id, %i(project_id programming_language_id)], + user_interacted_projects: [:index_user_interacted_projects_on_project_id_and_user_id, %i(project_id user_id)], + users_security_dashboard_projects: [:users_security_dashboard_projects_unique_index, %i(project_id user_id)] + }.freeze + + def up + TABLES.each do |table, (unique_index, _)| + with_lock_retries do + execute "ALTER TABLE #{table} ADD CONSTRAINT #{table}_pkey PRIMARY KEY USING INDEX #{unique_index}" if index_exists_by_name?(table, unique_index) + end + end + end + + def down + TABLES.each do |table, (unique_index, columns)| + add_concurrent_index table, columns, name: unique_index, unique: true + + with_lock_retries do + execute "ALTER TABLE #{table} DROP CONSTRAINT #{table}_pkey" + end + end + end +end diff --git a/db/schema_migrations/20201014163633 b/db/schema_migrations/20201014163633 new file mode 100644 index 00000000000..6025edca343 --- /dev/null +++ b/db/schema_migrations/20201014163633 @@ -0,0 +1 @@ +591bb8d685c686cced324825e7bec01711aee328176c1c5396a9e61847cb6fab
\ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index e22f21b309e..6691aa9c5b5 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -18332,6 +18332,9 @@ ALTER TABLE ONLY analytics_cycle_analytics_project_stages ALTER TABLE ONLY analytics_instance_statistics_measurements ADD CONSTRAINT analytics_instance_statistics_measurements_pkey PRIMARY KEY (id); +ALTER TABLE ONLY analytics_language_trend_repository_languages + ADD CONSTRAINT analytics_language_trend_repository_languages_pkey PRIMARY KEY (programming_language_id, project_id, snapshot_date); + ALTER TABLE ONLY appearances ADD CONSTRAINT appearances_pkey PRIMARY KEY (id); @@ -18362,6 +18365,9 @@ ALTER TABLE ONLY approval_project_rules_groups ALTER TABLE ONLY approval_project_rules ADD CONSTRAINT approval_project_rules_pkey PRIMARY KEY (id); +ALTER TABLE ONLY approval_project_rules_protected_branches + ADD CONSTRAINT approval_project_rules_protected_branches_pkey PRIMARY KEY (approval_project_rule_id, protected_branch_id); + ALTER TABLE ONLY approval_project_rules_users ADD CONSTRAINT approval_project_rules_users_pkey PRIMARY KEY (id); @@ -18464,6 +18470,9 @@ ALTER TABLE ONLY ci_build_trace_chunks ALTER TABLE ONLY ci_build_trace_section_names ADD CONSTRAINT ci_build_trace_section_names_pkey PRIMARY KEY (id); +ALTER TABLE ONLY ci_build_trace_sections + ADD CONSTRAINT ci_build_trace_sections_pkey PRIMARY KEY (build_id, section_name_id); + ALTER TABLE ONLY ci_builds_metadata ADD CONSTRAINT ci_builds_metadata_pkey PRIMARY KEY (id); @@ -18671,6 +18680,9 @@ ALTER TABLE ONLY deploy_tokens ALTER TABLE ONLY deployment_clusters ADD CONSTRAINT deployment_clusters_pkey PRIMARY KEY (deployment_id); +ALTER TABLE ONLY deployment_merge_requests + ADD CONSTRAINT deployment_merge_requests_pkey PRIMARY KEY (deployment_id, merge_request_id); + ALTER TABLE ONLY deployments ADD CONSTRAINT deployments_pkey PRIMARY KEY (id); @@ -18869,6 +18881,9 @@ ALTER TABLE ONLY issuable_severities ALTER TABLE ONLY issuable_slas ADD CONSTRAINT issuable_slas_pkey PRIMARY KEY (id); +ALTER TABLE ONLY issue_assignees + ADD CONSTRAINT issue_assignees_pkey PRIMARY KEY (issue_id, user_id); + ALTER TABLE ONLY issue_email_participants ADD CONSTRAINT issue_email_participants_pkey PRIMARY KEY (id); @@ -18887,6 +18902,12 @@ ALTER TABLE ONLY issue_user_mentions ALTER TABLE ONLY issues ADD CONSTRAINT issues_pkey PRIMARY KEY (id); +ALTER TABLE ONLY issues_prometheus_alert_events + ADD CONSTRAINT issues_prometheus_alert_events_pkey PRIMARY KEY (issue_id, prometheus_alert_event_id); + +ALTER TABLE ONLY issues_self_managed_prometheus_alert_events + ADD CONSTRAINT issues_self_managed_prometheus_alert_events_pkey PRIMARY KEY (issue_id, self_managed_prometheus_alert_event_id); + ALTER TABLE ONLY sprints ADD CONSTRAINT iteration_start_and_due_daterange_group_id_constraint EXCLUDE USING gist (group_id WITH =, daterange(start_date, due_date, '[]'::text) WITH &&) WHERE ((group_id IS NOT NULL)); @@ -18950,9 +18971,15 @@ ALTER TABLE ONLY merge_request_blocks ALTER TABLE ONLY merge_request_context_commits ADD CONSTRAINT merge_request_context_commits_pkey PRIMARY KEY (id); +ALTER TABLE ONLY merge_request_diff_commits + ADD CONSTRAINT merge_request_diff_commits_pkey PRIMARY KEY (merge_request_diff_id, relative_order); + ALTER TABLE ONLY merge_request_diff_details ADD CONSTRAINT merge_request_diff_details_pkey PRIMARY KEY (merge_request_diff_id); +ALTER TABLE ONLY merge_request_diff_files + ADD CONSTRAINT merge_request_diff_files_pkey PRIMARY KEY (merge_request_diff_id, relative_order); + ALTER TABLE ONLY merge_request_diffs ADD CONSTRAINT merge_request_diffs_pkey PRIMARY KEY (id); @@ -18980,6 +19007,9 @@ ALTER TABLE ONLY metrics_dashboard_annotations ALTER TABLE ONLY metrics_users_starred_dashboards ADD CONSTRAINT metrics_users_starred_dashboards_pkey PRIMARY KEY (id); +ALTER TABLE ONLY milestone_releases + ADD CONSTRAINT milestone_releases_pkey PRIMARY KEY (milestone_id, release_id); + ALTER TABLE ONLY milestones ADD CONSTRAINT milestones_pkey PRIMARY KEY (id); @@ -19133,6 +19163,9 @@ ALTER TABLE ONLY project_alerting_settings ALTER TABLE ONLY project_aliases ADD CONSTRAINT project_aliases_pkey PRIMARY KEY (id); +ALTER TABLE ONLY project_authorizations + ADD CONSTRAINT project_authorizations_pkey PRIMARY KEY (user_id, project_id, access_level); + ALTER TABLE ONLY project_auto_devops ADD CONSTRAINT project_auto_devops_pkey PRIMARY KEY (id); @@ -19178,6 +19211,9 @@ ALTER TABLE ONLY project_metrics_settings ALTER TABLE ONLY project_mirror_data ADD CONSTRAINT project_mirror_data_pkey PRIMARY KEY (id); +ALTER TABLE ONLY project_pages_metadata + ADD CONSTRAINT project_pages_metadata_pkey PRIMARY KEY (project_id); + ALTER TABLE ONLY project_repositories ADD CONSTRAINT project_repositories_pkey PRIMARY KEY (id); @@ -19235,6 +19271,9 @@ ALTER TABLE ONLY protected_tag_create_access_levels ALTER TABLE ONLY protected_tags ADD CONSTRAINT protected_tags_pkey PRIMARY KEY (id); +ALTER TABLE ONLY push_event_payloads + ADD CONSTRAINT push_event_payloads_pkey PRIMARY KEY (event_id); + ALTER TABLE ONLY push_rules ADD CONSTRAINT push_rules_pkey PRIMARY KEY (id); @@ -19253,6 +19292,9 @@ ALTER TABLE ONLY releases ALTER TABLE ONLY remote_mirrors ADD CONSTRAINT remote_mirrors_pkey PRIMARY KEY (id); +ALTER TABLE ONLY repository_languages + ADD CONSTRAINT repository_languages_pkey PRIMARY KEY (project_id, programming_language_id); + ALTER TABLE ONLY required_code_owners_sections ADD CONSTRAINT required_code_owners_sections_pkey PRIMARY KEY (id); @@ -19418,6 +19460,9 @@ ALTER TABLE ONLY user_details ALTER TABLE ONLY user_highest_roles ADD CONSTRAINT user_highest_roles_pkey PRIMARY KEY (user_id); +ALTER TABLE ONLY user_interacted_projects + ADD CONSTRAINT user_interacted_projects_pkey PRIMARY KEY (project_id, user_id); + ALTER TABLE ONLY user_preferences ADD CONSTRAINT user_preferences_pkey PRIMARY KEY (id); @@ -19433,6 +19478,9 @@ ALTER TABLE ONLY users_ops_dashboard_projects ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id); +ALTER TABLE ONLY users_security_dashboard_projects + ADD CONSTRAINT users_security_dashboard_projects_pkey PRIMARY KEY (project_id, user_id); + ALTER TABLE ONLY users_star_projects ADD CONSTRAINT users_star_projects_pkey PRIMARY KEY (id); @@ -19638,8 +19686,6 @@ CREATE INDEX analytics_index_events_on_created_at_and_author_id ON events USING CREATE INDEX analytics_repository_languages_on_project_id ON analytics_language_trend_repository_languages USING btree (project_id); -CREATE UNIQUE INDEX analytics_repository_languages_unique_index ON analytics_language_trend_repository_languages USING btree (programming_language_id, project_id, snapshot_date); - CREATE UNIQUE INDEX any_approver_merge_request_rule_type_unique_index ON approval_merge_request_rules USING btree (merge_request_id, rule_type) WHERE (rule_type = 4); CREATE UNIQUE INDEX any_approver_project_rule_type_unique_index ON approval_project_rules USING btree (project_id) WHERE (rule_type = 3); @@ -19682,8 +19728,6 @@ CREATE INDEX idx_container_exp_policies_on_project_id_next_run_at_enabled ON con CREATE INDEX idx_deployment_clusters_on_cluster_id_and_kubernetes_namespace ON deployment_clusters USING btree (cluster_id, kubernetes_namespace); -CREATE UNIQUE INDEX idx_deployment_merge_requests_unique_index ON deployment_merge_requests USING btree (deployment_id, merge_request_id); - CREATE UNIQUE INDEX idx_environment_merge_requests_unique_index ON deployment_merge_requests USING btree (environment_id, merge_request_id); CREATE INDEX idx_geo_con_rep_updated_events_on_container_repository_id ON geo_container_repository_updated_events USING btree (container_repository_id); @@ -19852,8 +19896,6 @@ CREATE INDEX index_approval_project_rules_on_rule_type ON approval_project_rules CREATE INDEX index_approval_project_rules_protected_branches_pb_id ON approval_project_rules_protected_branches USING btree (protected_branch_id); -CREATE UNIQUE INDEX index_approval_project_rules_protected_branches_unique ON approval_project_rules_protected_branches USING btree (approval_project_rule_id, protected_branch_id); - CREATE UNIQUE INDEX index_approval_project_rules_users_1 ON approval_project_rules_users USING btree (approval_project_rule_id, user_id); CREATE INDEX index_approval_project_rules_users_2 ON approval_project_rules_users USING btree (user_id); @@ -19978,8 +20020,6 @@ CREATE UNIQUE INDEX index_ci_build_trace_chunks_on_build_id_and_chunk_index ON c CREATE UNIQUE INDEX index_ci_build_trace_section_names_on_project_id_and_name ON ci_build_trace_section_names USING btree (project_id, name); -CREATE UNIQUE INDEX index_ci_build_trace_sections_on_build_id_and_section_name_id ON ci_build_trace_sections USING btree (build_id, section_name_id); - CREATE INDEX index_ci_build_trace_sections_on_project_id ON ci_build_trace_sections USING btree (project_id); CREATE INDEX index_ci_build_trace_sections_on_section_name_id ON ci_build_trace_sections USING btree (section_name_id); @@ -20686,8 +20726,6 @@ CREATE UNIQUE INDEX index_issuable_severities_on_issue_id ON issuable_severities CREATE UNIQUE INDEX index_issuable_slas_on_issue_id ON issuable_slas USING btree (issue_id); -CREATE UNIQUE INDEX index_issue_assignees_on_issue_id_and_user_id ON issue_assignees USING btree (issue_id, user_id); - CREATE INDEX index_issue_assignees_on_user_id ON issue_assignees USING btree (user_id); CREATE UNIQUE INDEX index_issue_email_participants_on_issue_id_and_email ON issue_email_participants USING btree (issue_id, email); @@ -20844,14 +20882,10 @@ CREATE INDEX index_merge_request_assignees_on_user_id ON merge_request_assignees CREATE INDEX index_merge_request_blocks_on_blocked_merge_request_id ON merge_request_blocks USING btree (blocked_merge_request_id); -CREATE UNIQUE INDEX index_merge_request_diff_commits_on_mr_diff_id_and_order ON merge_request_diff_commits USING btree (merge_request_diff_id, relative_order); - CREATE INDEX index_merge_request_diff_commits_on_sha ON merge_request_diff_commits USING btree (sha); CREATE INDEX index_merge_request_diff_details_on_merge_request_diff_id ON merge_request_diff_details USING btree (merge_request_diff_id); -CREATE UNIQUE INDEX index_merge_request_diff_files_on_mr_diff_id_and_order ON merge_request_diff_files USING btree (merge_request_diff_id, relative_order); - CREATE INDEX index_merge_request_diffs_by_id_partial ON merge_request_diffs USING btree (id) WHERE ((files_count > 0) AND ((NOT stored_externally) OR (stored_externally IS NULL))); CREATE INDEX index_merge_request_diffs_on_external_diff_store ON merge_request_diffs USING btree (external_diff_store); @@ -20954,8 +20988,6 @@ CREATE INDEX index_milestones_on_title ON milestones USING btree (title); CREATE INDEX index_milestones_on_title_trigram ON milestones USING gin (title gin_trgm_ops); -CREATE UNIQUE INDEX index_miletone_releases_on_milestone_and_release ON milestone_releases USING btree (milestone_id, release_id); - CREATE INDEX index_mirror_data_on_next_execution_and_retry_count ON project_mirror_data USING btree (next_execution_timestamp, retry_count); CREATE UNIQUE INDEX index_mr_blocks_on_blocking_and_blocked_mr_ids ON merge_request_blocks USING btree (blocking_merge_request_id, blocked_merge_request_id); @@ -21198,8 +21230,6 @@ CREATE INDEX index_project_aliases_on_project_id ON project_aliases USING btree CREATE INDEX index_project_authorizations_on_project_id ON project_authorizations USING btree (project_id); -CREATE UNIQUE INDEX index_project_authorizations_on_user_id_project_id_access_level ON project_authorizations USING btree (user_id, project_id, access_level); - CREATE UNIQUE INDEX index_project_auto_devops_on_project_id ON project_auto_devops USING btree (project_id); CREATE UNIQUE INDEX index_project_ci_cd_settings_on_project_id ON project_ci_cd_settings USING btree (project_id); @@ -21252,8 +21282,6 @@ CREATE INDEX index_project_pages_metadata_on_artifacts_archive_id ON project_pag CREATE INDEX index_project_pages_metadata_on_pages_deployment_id ON project_pages_metadata USING btree (pages_deployment_id); -CREATE UNIQUE INDEX index_project_pages_metadata_on_project_id ON project_pages_metadata USING btree (project_id); - CREATE INDEX index_project_pages_metadata_on_project_id_and_deployed_is_true ON project_pages_metadata USING btree (project_id) WHERE (deployed = true); CREATE UNIQUE INDEX index_project_repositories_on_disk_path ON project_repositories USING btree (disk_path); @@ -21426,8 +21454,6 @@ CREATE INDEX index_protected_tags_on_project_id ON protected_tags USING btree (p CREATE UNIQUE INDEX index_protected_tags_on_project_id_and_name ON protected_tags USING btree (project_id, name); -CREATE UNIQUE INDEX index_push_event_payloads_on_event_id ON push_event_payloads USING btree (event_id); - CREATE INDEX index_push_rules_on_is_sample ON push_rules USING btree (is_sample) WHERE is_sample; CREATE INDEX index_push_rules_on_project_id ON push_rules USING btree (project_id); @@ -21452,8 +21478,6 @@ CREATE INDEX index_remote_mirrors_on_last_successful_update_at ON remote_mirrors CREATE INDEX index_remote_mirrors_on_project_id ON remote_mirrors USING btree (project_id); -CREATE UNIQUE INDEX index_repository_languages_on_project_and_languages_id ON repository_languages USING btree (project_id, programming_language_id); - CREATE INDEX index_required_code_owners_sections_on_protected_branch_id ON required_code_owners_sections USING btree (protected_branch_id); CREATE INDEX index_requirements_management_test_reports_on_author_id ON requirements_management_test_reports USING btree (author_id); @@ -21766,8 +21790,6 @@ CREATE UNIQUE INDEX index_user_details_on_user_id ON user_details USING btree (u CREATE INDEX index_user_highest_roles_on_user_id_and_highest_access_level ON user_highest_roles USING btree (user_id, highest_access_level); -CREATE UNIQUE INDEX index_user_interacted_projects_on_project_id_and_user_id ON user_interacted_projects USING btree (project_id, user_id); - CREATE INDEX index_user_interacted_projects_on_user_id ON user_interacted_projects USING btree (user_id); CREATE INDEX index_user_preferences_on_gitpod_enabled ON user_preferences USING btree (gitpod_enabled); @@ -21962,10 +21984,6 @@ CREATE INDEX issue_id_issues_prometheus_alert_events_index ON issues_prometheus_ CREATE INDEX issue_id_issues_self_managed_rometheus_alert_events_index ON issues_self_managed_prometheus_alert_events USING btree (self_managed_prometheus_alert_event_id); -CREATE UNIQUE INDEX issue_id_prometheus_alert_event_id_index ON issues_prometheus_alert_events USING btree (issue_id, prometheus_alert_event_id); - -CREATE UNIQUE INDEX issue_id_self_managed_prometheus_alert_event_id_index ON issues_self_managed_prometheus_alert_events USING btree (issue_id, self_managed_prometheus_alert_event_id); - CREATE UNIQUE INDEX issue_user_mentions_on_issue_id_and_note_id_index ON issue_user_mentions USING btree (issue_id, note_id); CREATE UNIQUE INDEX issue_user_mentions_on_issue_id_index ON issue_user_mentions USING btree (issue_id) WHERE (note_id IS NULL); @@ -22022,8 +22040,6 @@ CREATE INDEX tmp_index_for_email_unconfirmation_migration ON emails USING btree CREATE UNIQUE INDEX unique_merge_request_metrics_by_merge_request_id ON merge_request_metrics USING btree (merge_request_id); -CREATE UNIQUE INDEX users_security_dashboard_projects_unique_index ON users_security_dashboard_projects USING btree (project_id, user_id); - CREATE UNIQUE INDEX vulnerability_feedback_unique_idx ON vulnerability_feedback USING btree (project_id, category, feedback_type, project_fingerprint); CREATE UNIQUE INDEX vulnerability_occurrence_pipelines_on_unique_keys ON vulnerability_occurrence_pipelines USING btree (occurrence_id, pipeline_id); diff --git a/doc/api/project_repository_storage_moves.md b/doc/api/project_repository_storage_moves.md index 1514552b185..e52d3e49909 100644 --- a/doc/api/project_repository_storage_moves.md +++ b/doc/api/project_repository_storage_moves.md @@ -194,7 +194,7 @@ Parameters: | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `project_id` | integer | yes | ID of the project | -| `destination_storage_name` | string | no | Name of the destination storage shard. In [GitLab 13.6 and later](https://gitlab.com/gitlab-org/gitaly/-/issues/3209), the storage is selected automatically if not provided. | +| `destination_storage_name` | string | no | Name of the destination storage shard. In [GitLab 13.5 and later](https://gitlab.com/gitlab-org/gitaly/-/issues/3209), the storage is selected automatically if not provided | Example request: diff --git a/doc/development/README.md b/doc/development/README.md index bc88c48baa1..830cc4a99a5 100644 --- a/doc/development/README.md +++ b/doc/development/README.md @@ -110,7 +110,6 @@ from: - [Working with Merge Request diffs](diffs.md) - [Kubernetes integration guidelines](kubernetes.md) - [Permissions](permissions.md) -- [Prometheus](prometheus.md) - [Guidelines for reusing abstractions](reusing_abstractions.md) - [DeclarativePolicy framework](policies.md) - [How Git object deduplication works in GitLab](git_object_deduplication.md) diff --git a/doc/development/documentation/graphql_styleguide.md b/doc/development/documentation/graphql_styleguide.md index 11e6b159359..ded647b8638 100644 --- a/doc/development/documentation/graphql_styleguide.md +++ b/doc/development/documentation/graphql_styleguide.md @@ -90,3 +90,7 @@ Be aware that CI tests for that second MR will fail with a bad link until the main MR that adds the new GraphQL page is merged. Therefore, only merge the MR against the [`gitlab-docs`](https://gitlab.com/gitlab-org/gitlab-docs) repository after the content has been merged and live on `docs.gitlab.com`. + +## Include a changelog entry + +All client-facing changes **must** include a [changelog entry](../changelog.md). diff --git a/doc/development/documentation/restful_api_styleguide.md b/doc/development/documentation/restful_api_styleguide.md index b12578b5d98..156b29ae36e 100644 --- a/doc/development/documentation/restful_api_styleguide.md +++ b/doc/development/documentation/restful_api_styleguide.md @@ -178,3 +178,8 @@ do something like this: ```shell curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" --data "skip_users[]=<user_id>" --data "skip_users[]=<user_id>" "https://gitlab.example.com/api/v4/projects/<project_id>/users" ``` + +## Include a changelog entry + +All client-facing changes **must** include a [changelog entry](../changelog.md). +This does not include internal APIs. diff --git a/doc/development/prometheus.md b/doc/development/prometheus.md index 3e7acaf6d94..fc1f2303d0a 100644 --- a/doc/development/prometheus.md +++ b/doc/development/prometheus.md @@ -1,59 +1,5 @@ --- -stage: Monitor -group: Health -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/#designated-technical-writers +redirect_to: '../user/project/integrations/prometheus.md' --- -# Working with Prometheus - -For more information on working with [Prometheus metrics](prometheus_metrics.md), see -the documentation. - -## Access the UI of a Prometheus managed application in Kubernetes - -You can connect directly to Prometheus, and view the Prometheus user interface, when -using a Prometheus managed application in Kubernetes: - -1. Find the name of the Prometheus pod in the user interface of your Kubernetes - provider, such as GKE, or by running the following `kubectl` command in your - terminal: - - ```shell - kubectl get pods -n gitlab-managed-apps | grep 'prometheus-prometheus-server' - ``` - - The command should return a result like the following example, where - `prometheus-prometheus-server-55b4bd64c9-dpc6b` is the name of the Prometheus pod: - - ```plaintext - gitlab-managed-apps prometheus-prometheus-server-55b4bd64c9-dpc6b 2/2 Running 0 71d - ``` - -1. Run a `kubectl port-forward` command. In the following example, `9090` is the - Prometheus server's listening port: - - ```shell - kubectl port-forward prometheus-prometheus-server-55b4bd64c9-dpc6b 9090:9090 -n gitlab-managed-apps - ``` - - The `port-forward` command forwards all requests sent to your system's `9090` port - to the `9090` port of the Prometheus pod. If the `9090` port on your system is used - by another application, you can change the port number before the colon to your - desired port. For example, to forward port `8080` of your local system, change the - command to: - - ```shell - kubectl port-forward prometheus-prometheus-server-55b4bd64c9-dpc6b 8080:9090 -n gitlab-managed-apps - ``` - -1. Open `localhost:9090` in your browser to display the Prometheus user interface. - -## Script access to Prometheus - -You can script the access to Prometheus, extracting the name of the pod automatically like this: - -```shell -POD_INFORMATION=$(kubectl get pods -n gitlab-managed-apps | grep 'prometheus-prometheus-server') -POD_NAME=$(echo $POD_INFORMATION | awk '{print $1;}') -kubectl port-forward $POD_NAME 9090:9090 -n gitlab-managed-apps -``` +This document was moved to [another location](../user/project/integrations/prometheus.md). diff --git a/doc/operations/metrics/dashboards/index.md b/doc/operations/metrics/dashboards/index.md index 4aa340a9e59..970bca70aff 100644 --- a/doc/operations/metrics/dashboards/index.md +++ b/doc/operations/metrics/dashboards/index.md @@ -226,7 +226,7 @@ links: ## Troubleshooting When troubleshooting issues with a managed Prometheus app, it is often useful to -[view the Prometheus UI](../../../development/prometheus.md#access-the-ui-of-a-prometheus-managed-application-in-kubernetes). +[view the Prometheus UI](../../../user/project/integrations/prometheus.md#access-the-ui-of-a-prometheus-managed-application-in-kubernetes). ### "No data found" error on Metrics dashboard page diff --git a/doc/topics/web_application_firewall/index.md b/doc/topics/web_application_firewall/index.md index 5ce7c0779bb..83b3bfb1cef 100644 --- a/doc/topics/web_application_firewall/index.md +++ b/doc/topics/web_application_firewall/index.md @@ -1,5 +1,5 @@ --- -stage: Defend +stage: Protect group: Container Security 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/#designated-technical-writers --- @@ -15,19 +15,14 @@ much more. ## Overview -GitLab provides a WAF out of the box after Ingress is deployed. -All you need to do is deploy your application along with a service -and Ingress resource. +GitLab provides a WAF out of the box after Ingress is deployed. All you need to do is deploy your +application along with a service and Ingress resource. In GitLab's [Ingress](../../user/clusters/applications.md#ingress) +deployment, the [ModSecurity](https://modsecurity.org/) +module is loaded into Ingress-NGINX by default and monitors the traffic going to the applications +which have an Ingress. The ModSecurity module runs with the [OWASP Core Rule Set (CRS)](https://coreruleset.org/) +by default. The OWASP CRS detects and logs a wide range of common attacks. -In GitLab's [Ingress](../../user/clusters/applications.md#ingress) deployment, the [ModSecurity](https://modsecurity.org/) module is loaded -into Ingress-NGINX by default and monitors the traffic going to the -applications which have an Ingress. - -The ModSecurity module runs with the [OWASP Core Rule Set (CRS)](https://coreruleset.org/) by default. The OWASP CRS will detect and log a wide range of common attacks. - -NOTE: **Note:** -The WAF is deployed in "Detection-only mode" by default and will only log attack -attempts. +By default, the WAF is deployed in Detection-only mode and only logs attack attempts. ## Requirements @@ -98,5 +93,5 @@ It is good to have a basic knowledge of the following: ## Roadmap -More information on the direction of the WAF can be -found in [Product Vision - Defend](https://about.gitlab.com/direction/defend/#waf) +You can find more information on the product direction of the WAF in +[Category Direction - Web Application Firewall](https://about.gitlab.com/direction/protect/web_application_firewall/). diff --git a/doc/topics/web_application_firewall/quick_start_guide.md b/doc/topics/web_application_firewall/quick_start_guide.md index 971250cd526..a0d59d2cbc5 100644 --- a/doc/topics/web_application_firewall/quick_start_guide.md +++ b/doc/topics/web_application_firewall/quick_start_guide.md @@ -1,5 +1,5 @@ --- -stage: Defend +stage: Protect group: Container Security 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/#designated-technical-writers --- @@ -17,7 +17,7 @@ These instructions will also work for a self-managed GitLab instance. However, y need to ensure your own [runners are configured](../../ci/runners/README.md) and [Google OAuth is enabled](../../integration/google.md). -**Note**: GitLab's Web Application Firewall is deployed with [Ingress](../../user/clusters/applications.md#ingress), +GitLab's Web Application Firewall is deployed with [Ingress](../../user/clusters/applications.md#ingress), so it will be available to your applications no matter how you deploy them to Kubernetes. ## Configuring your Google account @@ -252,7 +252,7 @@ You can now see the benefits of a using a Web Application Firewall. ModSecurity and the OWASP Core Rule Set, offer many more benefits. You can explore them in more detail: -- [GitLab Defend Vision](https://about.gitlab.com/direction/defend/#waf) +- [Category Direction - Web Application Firewall](https://about.gitlab.com/direction/protect/web_application_firewall/) - [ModSecurity](https://www.modsecurity.org/) - [OWASP Core Rule Set](https://github.com/coreruleset/coreruleset/) - [AutoDevOps](../autodevops/index.md) diff --git a/doc/user/application_security/container_scanning/index.md b/doc/user/application_security/container_scanning/index.md index ef38bbdc7df..36c4f2838f1 100644 --- a/doc/user/application_security/container_scanning/index.md +++ b/doc/user/application_security/container_scanning/index.md @@ -1,6 +1,6 @@ --- type: reference, howto -stage: Defend +stage: Protect group: Container Security 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/#designated-technical-writers --- diff --git a/doc/user/application_security/threat_monitoring/index.md b/doc/user/application_security/threat_monitoring/index.md index 391666a077e..f85d4f0140c 100644 --- a/doc/user/application_security/threat_monitoring/index.md +++ b/doc/user/application_security/threat_monitoring/index.md @@ -1,6 +1,6 @@ --- type: reference, howto -stage: Defend +stage: Protect group: Container Security 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/#designated-technical-writers --- diff --git a/doc/user/group/saml_sso/group_managed_accounts.md b/doc/user/group/saml_sso/group_managed_accounts.md index 7497d036d31..50f062bafa9 100644 --- a/doc/user/group/saml_sso/group_managed_accounts.md +++ b/doc/user/group/saml_sso/group_managed_accounts.md @@ -9,7 +9,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w CAUTION: **Caution:** This [Closed Beta](https://about.gitlab.com/handbook/product/gitlab-the-product/#sts=Closed%20Beta) feature is being re-evaluated in favor of a different -[identity model](https://gitlab.com/gitlab-org/gitlab/-/issues/218631) that does not require separate accounts. +[identity model](https://gitlab.com/groups/gitlab-org/-/epics/4345) that does not require separate accounts. We recommend that group administrators who haven't yet implemented this feature wait for the new solution. diff --git a/doc/user/project/clusters/securing.md b/doc/user/project/clusters/securing.md index bed01ff4d58..2d2dce275d2 100644 --- a/doc/user/project/clusters/securing.md +++ b/doc/user/project/clusters/securing.md @@ -1,5 +1,5 @@ --- -stage: Defend +stage: Protect group: Container Security 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/#designated-technical-writers --- diff --git a/doc/user/project/integrations/prometheus.md b/doc/user/project/integrations/prometheus.md index 28a9afa5bb0..97be16f8dd3 100644 --- a/doc/user/project/integrations/prometheus.md +++ b/doc/user/project/integrations/prometheus.md @@ -95,6 +95,55 @@ spec: targetPort: ${CONTAINER_PORT} ``` +#### Access the UI of a Prometheus managed application in Kubernetes + +You can connect directly to Prometheus, and view the Prometheus user interface, when +using a Prometheus managed application in Kubernetes: + +1. Find the name of the Prometheus pod in the user interface of your Kubernetes + provider, such as GKE, or by running the following `kubectl` command in your + terminal: + + ```shell + kubectl get pods -n gitlab-managed-apps | grep 'prometheus-prometheus-server' + ``` + + The command should return a result like the following example, where + `prometheus-prometheus-server-55b4bd64c9-dpc6b` is the name of the Prometheus pod: + + ```plaintext + gitlab-managed-apps prometheus-prometheus-server-55b4bd64c9-dpc6b 2/2 Running 0 71d + ``` + +1. Run a `kubectl port-forward` command. In the following example, `9090` is the + Prometheus server's listening port: + + ```shell + kubectl port-forward prometheus-prometheus-server-55b4bd64c9-dpc6b 9090:9090 -n gitlab-managed-apps + ``` + + The `port-forward` command forwards all requests sent to your system's `9090` port + to the `9090` port of the Prometheus pod. If the `9090` port on your system is used + by another application, you can change the port number before the colon to your + desired port. For example, to forward port `8080` of your local system, change the + command to: + + ```shell + kubectl port-forward prometheus-prometheus-server-55b4bd64c9-dpc6b 8080:9090 -n gitlab-managed-apps + ``` + +1. Open `localhost:9090` in your browser to display the Prometheus user interface. + +#### Script access to Prometheus + +You can script the access to Prometheus, extracting the name of the pod automatically like this: + +```shell +POD_INFORMATION=$(kubectl get pods -n gitlab-managed-apps | grep 'prometheus-prometheus-server') +POD_NAME=$(echo $POD_INFORMATION | awk '{print $1;}') +kubectl port-forward $POD_NAME 9090:9090 -n gitlab-managed-apps +``` + ### Manual configuration of Prometheus #### Requirements diff --git a/lib/gitlab/database/batch_count.rb b/lib/gitlab/database/batch_count.rb index 11d9881aac2..6f79e965cd5 100644 --- a/lib/gitlab/database/batch_count.rb +++ b/lib/gitlab/database/batch_count.rb @@ -128,9 +128,9 @@ module Gitlab end def between_condition(start, finish) - return @column.between(start..(finish - 1)) if @column.is_a?(Arel::Attributes::Attribute) + return @column.between(start...finish) if @column.is_a?(Arel::Attributes::Attribute) - { @column => start..(finish - 1) } + { @column => start...finish } end def actual_start(start) diff --git a/package.json b/package.json index 7f25c54aa87..b86f1508a07 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@babel/plugin-syntax-import-meta": "^7.10.1", "@babel/preset-env": "^7.10.1", "@gitlab/at.js": "1.5.5", - "@gitlab/svgs": "1.171.0", + "@gitlab/svgs": "1.172.0", "@gitlab/ui": "21.35.1", "@gitlab/visual-review-tools": "1.6.1", "@rails/actioncable": "^6.0.3-3", diff --git a/qa/qa/page/dashboard/snippet/edit.rb b/qa/qa/page/dashboard/snippet/edit.rb index 37c0747aea4..d6e50b2689a 100644 --- a/qa/qa/page/dashboard/snippet/edit.rb +++ b/qa/qa/page/dashboard/snippet/edit.rb @@ -9,6 +9,11 @@ module QA element :submit_button, required: true end + view 'app/assets/javascripts/snippets/components/snippet_blob_edit.vue' do + element :file_name_field + element :file_holder_container + end + def add_to_file_content(content) text_area.set content text_area.has_text?(content) # wait for changes to take effect @@ -18,7 +23,32 @@ module QA choose(visibility_type) end + def click_add_file + click_element(:add_file_button) + end + + def fill_file_name(name, file_number = nil) + if file_number + within_element_by_index(:file_holder_container, file_number - 1) do + fill_element(:file_name_field, name) + end + else + fill_element(:file_name_field, name) + end + end + + def fill_file_content(content, file_number = nil) + if file_number + within_element_by_index(:file_holder_container, file_number - 1) do + text_area.set(content) + end + else + text_area.set(content) + end + end + def save_changes + wait_until(reload: false) { !find_element(:submit_button).disabled? } click_element(:submit_button, Page::Dashboard::Snippet::Show) end diff --git a/qa/qa/resource/project_snippet.rb b/qa/qa/resource/project_snippet.rb index 6fa38baaa91..c262499664e 100644 --- a/qa/qa/resource/project_snippet.rb +++ b/qa/qa/resource/project_snippet.rb @@ -31,6 +31,14 @@ module QA new_snippet.click_create_snippet_button end end + + def api_get_path + "/projects/#{project.id}/snippets/#{snippet_id}" + end + + def api_post_path + "/projects/#{project.id}/snippets" + end end end end diff --git a/qa/qa/resource/snippet.rb b/qa/qa/resource/snippet.rb index c4ea6447209..648fa74eca8 100644 --- a/qa/qa/resource/snippet.rb +++ b/qa/qa/resource/snippet.rb @@ -3,7 +3,7 @@ module QA module Resource class Snippet < Base - attr_accessor :title, :description, :file_content, :visibility, :file_name + attr_accessor :title, :description, :file_content, :visibility, :file_name, :snippet_id def initialize @title = 'New snippet title' @@ -36,6 +36,34 @@ module QA new_page.click_create_snippet_button end end + + def fabricate_via_api! + resource_web_url(api_post) + rescue ResourceNotFoundError + super + end + + def api_get_path + "/snippets/#{snippet_id}" + end + + def api_post_path + '/snippets' + end + + def api_post_body + { + title: title, + description: description, + visibility: visibility.downcase, + files: [ + { + content: file_content, + file_path: file_name + } + ] + } + end end end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb index 9a054e7d1c8..31776ec85ee 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Plan', :reliable do + RSpec.describe 'Plan' do describe 'filter issue comments activities' do before do Flow::Login.sign_in diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/add_file_to_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/add_file_to_snippet_spec.rb new file mode 100644 index 00000000000..469335db5ab --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/add_file_to_snippet_spec.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Multiple file snippet' do + let(:personal_snippet) do + Resource::Snippet.fabricate_via_api! do |snippet| + snippet.title = 'Personal snippet to add file to' + snippet.file_name = 'Original file name' + snippet.file_content = 'Original file content' + end + end + + let(:project_snippet) do + Resource::ProjectSnippet.fabricate_via_api! do |snippet| + snippet.title = 'Project snippet to add file to' + snippet.file_name = 'Original file name' + snippet.file_content = 'Original file content' + end + end + + before do + Flow::Login.sign_in + end + + shared_examples 'adding file to snippet' do |snippet_type| + it "adds second file to an existing #{snippet_type} to make it multi-file" do + send(snippet_type).visit! + + Page::Dashboard::Snippet::Show.perform(&:click_edit_button) + + Page::Dashboard::Snippet::Edit.perform do |snippet| + snippet.click_add_file + snippet.fill_file_name('Second file name', 2) + snippet.fill_file_content('Second file content', 2) + snippet.save_changes + end + + Page::Dashboard::Snippet::Show.perform do |snippet| + aggregate_failures 'file names and contents' do + expect(snippet).to have_file_name('Original file name', 1) + expect(snippet).to have_file_content('Original file content', 1) + expect(snippet).to have_file_name('Second file name', 2) + expect(snippet).to have_file_content('Second file content', 2) + end + end + end + end + + it_behaves_like 'adding file to snippet', :personal_snippet + it_behaves_like 'adding file to snippet', :project_snippet + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb index a3f6d521766..f67d4f1e96e 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb @@ -22,13 +22,13 @@ module QA end let(:repository_uri_http) do - snippet + snippet.visit! Page::Dashboard::Snippet::Show.perform(&:get_repository_uri_http) end let(:repository_uri_ssh) do ssh_key - snippet + snippet.visit! Page::Dashboard::Snippet::Show.perform(&:get_repository_uri_ssh) end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb index be56b870490..7f372245f24 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb @@ -22,13 +22,13 @@ module QA end let(:repository_uri_http) do - snippet + snippet.visit! Page::Dashboard::Snippet::Show.perform(&:get_repository_uri_http) end let(:repository_uri_ssh) do ssh_key - snippet + snippet.visit! Page::Dashboard::Snippet::Show.perform(&:get_repository_uri_ssh) end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb index 6b21d84cb13..971c5371d44 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb @@ -18,7 +18,7 @@ module QA context 'when the snippet is public' do it 'can be shared with not signed-in users', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1016' do - snippet + snippet.visit! sharing_link = Page::Dashboard::Snippet::Show.perform do |snippet| expect(snippet).to have_embed_dropdown @@ -40,7 +40,7 @@ module QA context 'when the snippet is changed to private' do it 'does not display Embed/Share dropdown', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1015' do - snippet + snippet.visit! Page::Dashboard::Snippet::Show.perform do |snippet| expect(snippet).to have_embed_dropdown diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index 06fafbddced..c35f3831a58 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -241,25 +241,9 @@ RSpec.describe 'Database schema' do context 'primary keys' do let(:exceptions) do %i( - analytics_language_trend_repository_languages - approval_project_rules_protected_branches - ci_build_trace_sections - deployment_merge_requests elasticsearch_indexed_namespaces elasticsearch_indexed_projects - issue_assignees - issues_prometheus_alert_events - issues_self_managed_prometheus_alert_events merge_request_context_commit_diff_files - merge_request_diff_commits - merge_request_diff_files - milestone_releases - project_authorizations - project_pages_metadata - push_event_payloads - repository_languages - user_interacted_projects - users_security_dashboard_projects ) end diff --git a/spec/lib/gitlab/database/batch_count_spec.rb b/spec/lib/gitlab/database/batch_count_spec.rb index 31a8b4afa03..a1cc759e011 100644 --- a/spec/lib/gitlab/database/batch_count_spec.rb +++ b/spec/lib/gitlab/database/batch_count_spec.rb @@ -141,6 +141,29 @@ RSpec.describe Gitlab::Database::BatchCount do described_class.batch_count(model) end + it 'does not use BETWEEN to define the range' do + batch_size = Gitlab::Database::BatchCounter::MIN_REQUIRED_BATCH_SIZE + 1 + issue = nil + + travel_to(Date.tomorrow) do + issue = create(:issue) # created_at: 00:00:00 + create(:issue, created_at: issue.created_at + batch_size - 0.5) # created_at: 00:20:50.5 + create(:issue, created_at: issue.created_at + batch_size) # created_at: 00:20:51 + end + + # When using BETWEEN, the range condition looks like: + # Batch 1: WHERE "issues"."created_at" BETWEEN "2020-10-09 00:00:00" AND "2020-10-09 00:20:50" + # Batch 2: WHERE "issues"."created_at" BETWEEN "2020-10-09 00:20:51" AND "2020-10-09 00:41:41" + # We miss the issue created at 00:20:50.5 because we prevent the batches from overlapping (start..(finish - 1)) + # See https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_BETWEEN_.28especially_with_timestamps.29 + + # When using >= AND <, we eliminate any gaps between batches (start...finish) + # This is useful when iterating over a timestamp column + # Batch 1: WHERE "issues"."created_at" >= "2020-10-09 00:00:00" AND "issues"."created_at" < "2020-10-09 00:20:51" + # Batch 1: WHERE "issues"."created_at" >= "2020-10-09 00:20:51" AND "issues"."created_at" < "2020-10-09 00:41:42" + expect(described_class.batch_count(model, :created_at, batch_size: batch_size, start: issue.created_at)).to eq(3) + end + it_behaves_like 'when a transaction is open' do subject { described_class.batch_count(model) } end diff --git a/vendor/gitignore/C++.gitignore b/vendor/gitignore/C++.gitignore index 259148fa18f..259148fa18f 100755..100644 --- a/vendor/gitignore/C++.gitignore +++ b/vendor/gitignore/C++.gitignore diff --git a/vendor/gitignore/Java.gitignore b/vendor/gitignore/Java.gitignore index a1c2a238a96..a1c2a238a96 100755..100644 --- a/vendor/gitignore/Java.gitignore +++ b/vendor/gitignore/Java.gitignore diff --git a/yarn.lock b/yarn.lock index 8f1c887e7bc..2936039b37b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -861,10 +861,10 @@ eslint-plugin-vue "^6.2.1" vue-eslint-parser "^7.0.0" -"@gitlab/svgs@1.171.0": - version "1.171.0" - resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.171.0.tgz#abc3092bf804f0898301626130e0f3231834924a" - integrity sha512-TPfdqIxQDda+0CQHhb9XdF50lmqDmADu6yT8R4oZi6BoUtWLdiHbyFt+RnVU6t7EmjIKicNAii7Ga+f2ljCfUA== +"@gitlab/svgs@1.172.0": + version "1.172.0" + resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.172.0.tgz#4a3b15d829b66073b61c52720c7728bc3066ac89" + integrity sha512-c+gsw78qzF6H5bH6JZ0MKjqtD89m/ym/F4SqEK+ywHPRHqixmgDg8CtB782dl5rrTkW6aaIue8VcJn+Vziki0A== "@gitlab/ui@21.35.1": version "21.35.1" |