diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-24 21:10:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-24 21:10:28 +0300 |
commit | e20fed01c86f47ffba316483f312a36330fd084d (patch) | |
tree | a97c23d9f1729ca3637c78769ebe1663e0765bb7 | |
parent | e778dcbceebbfbae42a3743cf76d80229ccc716c (diff) |
Add latest changes from gitlab-org/gitlab@master
62 files changed, 667 insertions, 177 deletions
diff --git a/.gitlab/ci/docs.gitlab-ci.yml b/.gitlab/ci/docs.gitlab-ci.yml index c6d2b30046c..18954e7b8e0 100644 --- a/.gitlab/ci/docs.gitlab-ci.yml +++ b/.gitlab/ci/docs.gitlab-ci.yml @@ -76,14 +76,16 @@ docs-code-quality: - .docs-markdown-lint-image stage: lint needs: [] + allow_failure: true script: - - vale --output=doc/.vale/vale-json.tmpl --minAlertLevel warning doc > gl-code-quality-report-docs.json || exit_code=$? + - scripts/lint-doc-quality.sh artifacts: reports: codequality: gl-code-quality-report-docs.json paths: - gl-code-quality-report-docs.json expire_in: 1 week + when: always ui-docs-links lint: extends: diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 79da496d782..830fbf64d38 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -806,8 +806,7 @@ .docs:rules:docs-code-quality: rules: - - <<: *if-default-branch-refs - - <<: *if-default-refs + - <<: *if-merge-request changes: *docs-code-quality-patterns .docs:rules:docs-lint: diff --git a/.rubocop.yml b/.rubocop.yml index ec57bf14174..143a7db9ae7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -299,6 +299,10 @@ Rails/MailerName: # See for the context on why it's excluded https://gitlab.com/gitlab-org/gitlab/-/issues/239356#note_956419227 - 'app/mailers/notify.rb' +Rails/Pluck: + # See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/94047#note_1179689274 + AutoCorrect: false + Rails/RakeEnvironment: # Context on why it's disabled: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/93419#note_1048223982 Enabled: false diff --git a/.rubocop_todo/rails/pluck.yml b/.rubocop_todo/rails/pluck.yml index 5e875daa569..6d8dd530bac 100644 --- a/.rubocop_todo/rails/pluck.yml +++ b/.rubocop_todo/rails/pluck.yml @@ -1,10 +1,9 @@ --- -# Cop supports --auto-correct. +# Cop supports --autocorrect but disabled. Rails/Pluck: - # Offense count: 155 - # Temporarily disabled due to too many offenses - Enabled: false + Details: grace period Exclude: + - 'app/controllers/ldap/omniauth_callbacks_controller.rb' - 'app/finders/merge_requests/oldest_per_commit_finder.rb' - 'app/helpers/issuables_description_templates_helper.rb' - 'app/models/ci/unit_test.rb' @@ -12,10 +11,18 @@ Rails/Pluck: - 'app/models/concerns/sensitive_serializable_hash.rb' - 'app/models/integrations/chat_message/pipeline_message.rb' - 'app/models/list.rb' + - 'app/models/packages/go/module_version.rb' + - 'app/models/work_items/parent_link.rb' - 'app/services/ci/pipeline_processing/atomic_processing_service/status_collection.rb' - 'app/services/feature_flags/update_service.rb' + - 'app/services/todos/destroy/destroyed_issuable_service.rb' + - 'app/workers/database/ci_namespace_mirrors_consistency_check_worker.rb' + - 'app/workers/database/ci_project_mirrors_consistency_check_worker.rb' + - 'db/post_migrate/20210811122206_update_external_project_bots.rb' + - 'ee/app/graphql/mutations/incident_management/escalation_policy/base.rb' - 'ee/app/graphql/mutations/incident_management/oncall_rotation/base.rb' - 'ee/app/models/boards/epic_list.rb' + - 'ee/app/models/concerns/geo/verification_state.rb' - 'ee/app/services/concerns/incident_management/oncall_rotations/shared_rotation_logic.rb' - 'ee/app/workers/geo/container_repository_sync_dispatch_worker.rb' - 'ee/app/workers/geo/registry_sync_worker.rb' @@ -24,55 +31,165 @@ Rails/Pluck: - 'ee/app/workers/geo/scheduler/scheduler_worker.rb' - 'ee/lib/ee/banzai/filter/references/iteration_reference_filter.rb' - 'ee/lib/ee/gitlab/auth/ldap/person.rb' + - 'ee/lib/ee/gitlab/background_migration/delete_invalid_epic_issues.rb' - 'ee/lib/ee/gitlab/background_migration/populate_uuids_for_security_findings.rb' - 'ee/lib/ee/gitlab/checks/push_rules/file_size_check.rb' + - 'ee/lib/elastic/latest/custom_language_analyzers.rb' - 'ee/lib/gitlab/ci/reports/license_scanning/report.rb' + - 'ee/lib/gitlab/search/index_curator.rb' + - 'ee/spec/controllers/autocomplete_controller_spec.rb' + - 'ee/spec/controllers/countries_controller_spec.rb' - 'ee/spec/controllers/groups/audit_events_controller_spec.rb' + - 'ee/spec/controllers/operations_controller_spec.rb' - 'ee/spec/controllers/projects/audit_events_controller_spec.rb' + - 'ee/spec/controllers/projects/feature_flag_issues_controller_spec.rb' + - 'ee/spec/controllers/projects/licenses_controller_spec.rb' + - 'ee/spec/controllers/projects/security/configuration_controller_spec.rb' + - 'ee/spec/features/projects/new_project_spec.rb' + - 'ee/spec/graphql/api/vulnerabilities_spec.rb' + - 'ee/spec/graphql/types/vulnerability_scanner_type_spec.rb' - 'ee/spec/helpers/ee/geo_helper_spec.rb' + - 'ee/spec/helpers/ee/operations_helper_spec.rb' + - 'ee/spec/lib/ee/gitlab/import_export/group/legacy_tree_saver_spec.rb' + - 'ee/spec/lib/ee/gitlab/import_export/group/tree_saver_spec.rb' - 'ee/spec/lib/gitlab/custom_file_templates_spec.rb' - 'ee/spec/lib/gitlab/spdx/catalogue_spec.rb' - 'ee/spec/models/analytics/cycle_analytics/group_level_spec.rb' + - 'ee/spec/models/concerns/geo/verification_state_spec.rb' - 'ee/spec/models/dast_site_profile_spec.rb' - 'ee/spec/models/integrations/chat_message/vulnerability_message_spec.rb' + - 'ee/spec/models/release_highlight_spec.rb' + - 'ee/spec/requests/api/analytics/code_review_analytics_spec.rb' + - 'ee/spec/requests/api/epic_links_spec.rb' + - 'ee/spec/requests/api/epics_spec.rb' + - 'ee/spec/requests/api/graphql/boards/board_lists_query_spec.rb' + - 'ee/spec/requests/api/graphql/boards/epic_boards_query_spec.rb' + - 'ee/spec/requests/api/graphql/boards/epic_lists_query_spec.rb' + - 'ee/spec/requests/api/graphql/ci/runners_spec.rb' + - 'ee/spec/requests/api/graphql/epics/epic_resolver_spec.rb' + - 'ee/spec/requests/api/graphql/iterations/cadences_spec.rb' + - 'ee/spec/requests/api/graphql/iterations/iterations_spec.rb' + - 'ee/spec/requests/api/graphql/mutations/analytics/devops_adoption/enabled_namespaces/bulk_enable_spec.rb' + - 'ee/spec/requests/api/graphql/mutations/epics/update_spec.rb' - 'ee/spec/requests/api/graphql/mutations/releases/create_spec.rb' - 'ee/spec/requests/api/graphql/mutations/releases/update_spec.rb' + - 'ee/spec/requests/api/graphql/project/dast_profiles_spec.rb' + - 'ee/spec/requests/api/graphql/project/dast_site_validations_spec.rb' + - 'ee/spec/requests/api/graphql/project/incident_management/escalation_policy/rules_spec.rb' + - 'ee/spec/requests/api/graphql/project/pipeline/code_quality_reports_spec.rb' + - 'ee/spec/requests/api/graphql/vulnerabilities/issue_links_spec.rb' + - 'ee/spec/requests/api/groups_spec.rb' + - 'ee/spec/requests/api/iterations_spec.rb' + - 'ee/spec/requests/api/members_spec.rb' + - 'ee/spec/requests/api/merge_request_approval_rules_spec.rb' + - 'ee/spec/requests/api/project_approval_rules_spec.rb' + - 'ee/spec/requests/api/project_approval_settings_spec.rb' + - 'ee/spec/requests/api/projects_spec.rb' + - 'ee/spec/requests/api/protected_branches_spec.rb' + - 'ee/spec/requests/api/protected_environments_spec.rb' + - 'ee/spec/requests/api/protected_tags_spec.rb' + - 'ee/spec/requests/api/releases_spec.rb' + - 'ee/spec/requests/api/search_spec.rb' + - 'ee/spec/requests/api/status_checks_spec.rb' + - 'ee/spec/requests/api/users_spec.rb' + - 'ee/spec/requests/api/vulnerabilities_spec.rb' + - 'ee/spec/requests/api/vulnerability_findings_spec.rb' + - 'ee/spec/requests/api/vulnerability_issue_links_spec.rb' + - 'ee/spec/requests/ee/groups/autocomplete_sources_spec.rb' + - 'ee/spec/requests/groups/protected_environments_controller_spec.rb' + - 'ee/spec/requests/projects/issue_feature_flags_controller_spec.rb' - 'ee/spec/services/analytics/cycle_analytics/stages/update_service_spec.rb' - 'ee/spec/services/analytics/cycle_analytics/value_streams/create_service_spec.rb' - 'ee/spec/services/analytics/cycle_analytics/value_streams/update_service_spec.rb' - 'ee/spec/services/ee/groups/autocomplete_service_spec.rb' + - 'ee/spec/services/ee/releases/create_evidence_service_spec.rb' + - 'ee/spec/services/iterations/cadences/create_iterations_in_advance_service_spec.rb' - 'ee/spec/services/quick_actions/interpret_service_spec.rb' + - 'ee/spec/support/elastic.rb' + - 'ee/spec/support/helpers/feature_approval_helper.rb' + - 'ee/spec/support/shared_examples/controllers/analytics/cycle_analytics/shared_stage_shared_examples.rb' + - 'ee/spec/support/shared_examples/requests/api/graphql/incident_management/escalation_policies_shared_examples.rb' + - 'lib/atlassian/jira_connect/client.rb' - 'lib/banzai/filter/references/label_reference_filter.rb' - 'lib/banzai/filter/references/milestone_reference_filter.rb' - 'lib/banzai/renderer.rb' - 'lib/gitlab/access.rb' - 'lib/gitlab/analytics/cycle_analytics/default_stages.rb' + - 'lib/gitlab/bullet/exclusions.rb' - 'lib/gitlab/checks/lfs_check.rb' - 'lib/gitlab/ci/pipeline/chain/build/associations.rb' - 'lib/gitlab/ci/pipeline/chain/validate/external.rb' - 'lib/gitlab/ci/variables/collection/sort.rb' - 'lib/gitlab/config/entry/validators.rb' + - 'lib/gitlab/cycle_analytics/updater.rb' + - 'lib/gitlab/database/migration_helpers.rb' + - 'lib/gitlab/database/partitioning_migration_helpers/index_helpers.rb' - 'lib/gitlab/git_access.rb' + - 'lib/gitlab/github_import/representation/issue.rb' + - 'lib/gitlab/jira_import/metadata_collector.rb' + - 'lib/gitlab/merge_requests/commit_message_generator.rb' - 'lib/gitlab/metrics/dashboard/importers/prometheus_metrics.rb' - 'lib/gitlab/metrics/dashboard/stages/custom_metrics_details_inserter.rb' - 'lib/gitlab/sidekiq_config/cli_methods.rb' + - 'lib/gitlab/sql/pattern.rb' - 'lib/gitlab/usage/metrics/name_suggestion.rb' - 'lib/gitlab/usage_data_counters/hll_redis_counter.rb' - - 'qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb' - - 'qa/qa/support/page_error_checker.rb' + - 'lib/gitlab/zentao/client.rb' + - 'lib/tasks/gitlab/info.rake' + - 'qa/qa/specs/features/api/1_manage/import/import_github_repo_spec.rb' + - 'qa/qa/specs/features/api/1_manage/migration/gitlab_migration_mr_spec.rb' + - 'qa/qa/specs/features/browser_ui/1_manage/integrations/jira/jira_basic_integration_spec.rb' + - 'qa/qa/tools/ci/qa_changes.rb' + - 'qa/qa/tools/delete_projects.rb' + - 'qa/qa/tools/delete_test_snippets.rb' + - 'qa/qa/tools/delete_test_ssh_keys.rb' + - 'qa/qa/tools/delete_test_users.rb' + - 'qa/qa/tools/delete_user_projects.rb' - 'scripts/perf/query_limiting_report.rb' - 'spec/config/mail_room_spec.rb' - - 'spec/config/metrics/aggregates/aggregated_metrics_spec.rb' + - 'spec/controllers/autocomplete_controller_spec.rb' + - 'spec/controllers/dashboard/milestones_controller_spec.rb' + - 'spec/controllers/groups/labels_controller_spec.rb' + - 'spec/controllers/groups/milestones_controller_spec.rb' + - 'spec/controllers/groups/releases_controller_spec.rb' + - 'spec/controllers/groups/shared_projects_controller_spec.rb' + - 'spec/controllers/projects/analytics/cycle_analytics/stages_controller_spec.rb' + - 'spec/controllers/projects/autocomplete_sources_controller_spec.rb' + - 'spec/controllers/projects/environments_controller_spec.rb' + - 'spec/controllers/projects/feature_flags_controller_spec.rb' + - 'spec/controllers/projects/issues_controller_spec.rb' + - 'spec/controllers/projects/jobs_controller_spec.rb' + - 'spec/controllers/projects/merge_requests/conflicts_controller_spec.rb' + - 'spec/controllers/projects/merge_requests/diffs_controller_spec.rb' + - 'spec/controllers/projects/pipelines/tests_controller_spec.rb' + - 'spec/controllers/projects/releases_controller_spec.rb' + - 'spec/controllers/projects/starrers_controller_spec.rb' + - 'spec/db/schema_spec.rb' + - 'spec/features/issues/csv_spec.rb' + - 'spec/features/merge_request/user_sees_versions_spec.rb' - 'spec/finders/license_template_finder_spec.rb' - 'spec/graphql/resolvers/ci/test_suite_resolver_spec.rb' + - 'spec/graphql/resolvers/concerns/looks_ahead_spec.rb' + - 'spec/graphql/resolvers/namespace_projects_resolver_spec.rb' + - 'spec/graphql/types/ci/job_token_scope_type_spec.rb' + - 'spec/graphql/types/snippet_type_spec.rb' - 'spec/helpers/groups/group_members_helper_spec.rb' + - 'spec/helpers/projects/project_members_helper_spec.rb' - 'spec/lib/atlassian/jira_connect/serializers/pull_request_entity_spec.rb' - 'spec/lib/banzai/reference_redactor_spec.rb' + - 'spec/lib/bulk_imports/groups/stage_spec.rb' + - 'spec/lib/bulk_imports/projects/stage_spec.rb' - 'spec/lib/gitlab/ci/ansi2json/line_spec.rb' - 'spec/lib/gitlab/ci/yaml_processor_spec.rb' - 'spec/lib/gitlab/conflict/file_spec.rb' + - 'spec/lib/gitlab/database/load_balancing/transaction_leaking_spec.rb' + - 'spec/lib/gitlab/database/similarity_score_spec.rb' + - 'spec/lib/gitlab/database_importers/common_metrics/importer_spec.rb' - 'spec/lib/gitlab/git/blame_spec.rb' - 'spec/lib/gitlab/git/conflict/parser_spec.rb' + - 'spec/lib/gitlab/import_export/group/legacy_tree_saver_spec.rb' + - 'spec/lib/gitlab/import_export/project/sample/relation_tree_restorer_spec.rb' + - 'spec/lib/gitlab/import_export/project/tree_saver_spec.rb' - 'spec/lib/gitlab/language_detection_spec.rb' - 'spec/lib/gitlab/lograge/custom_options_spec.rb' - 'spec/lib/gitlab/metrics/dashboard/processor_spec.rb' @@ -80,9 +197,11 @@ Rails/Pluck: - 'spec/lib/gitlab/relative_positioning/item_context_spec.rb' - 'spec/lib/gitlab/search/query_spec.rb' - 'spec/lib/gitlab/sidekiq_config/worker_matcher_spec.rb' + - 'spec/lib/gitlab/sidekiq_middleware/duplicate_jobs/client_spec.rb' - 'spec/lib/gitlab/tree_summary_spec.rb' - 'spec/lib/peek/views/rugged_spec.rb' - 'spec/migrations/20210713042000_fix_ci_sources_pipelines_index_names_spec.rb' + - 'spec/models/bulk_imports/entity_spec.rb' - 'spec/models/ci/bridge_spec.rb' - 'spec/models/ci/build_spec.rb' - 'spec/models/ci/pipeline_spec.rb' @@ -94,12 +213,97 @@ Rails/Pluck: - 'spec/models/project_spec.rb' - 'spec/presenters/packages/detail/package_presenter_spec.rb' - 'spec/presenters/packages/nuget/service_index_presenter_spec.rb' + - 'spec/requests/api/admin/instance_clusters_spec.rb' + - 'spec/requests/api/branches_spec.rb' + - 'spec/requests/api/ci/pipeline_schedules_spec.rb' + - 'spec/requests/api/ci/pipelines_spec.rb' + - 'spec/requests/api/commit_statuses_spec.rb' + - 'spec/requests/api/commits_spec.rb' + - 'spec/requests/api/deploy_tokens_spec.rb' + - 'spec/requests/api/deployments_spec.rb' + - 'spec/requests/api/events_spec.rb' + - 'spec/requests/api/feature_flags_spec.rb' + - 'spec/requests/api/feature_flags_user_lists_spec.rb' + - 'spec/requests/api/files_spec.rb' + - 'spec/requests/api/graphql/boards/board_list_issues_query_spec.rb' + - 'spec/requests/api/graphql/ci/manual_variables_spec.rb' + - 'spec/requests/api/graphql/ci/pipelines_spec.rb' + - 'spec/requests/api/graphql/ci/runners_spec.rb' + - 'spec/requests/api/graphql/group/timelogs_spec.rb' + - 'spec/requests/api/graphql/group_query_spec.rb' + - 'spec/requests/api/graphql/mutations/design_management/move_spec.rb' + - 'spec/requests/api/graphql/packages/package_spec.rb' + - 'spec/requests/api/graphql/project/alert_management/alerts_spec.rb' + - 'spec/requests/api/graphql/project/base_service_spec.rb' + - 'spec/requests/api/graphql/project/issue/design_collection/version_spec.rb' + - 'spec/requests/api/graphql/project/issue/designs/designs_spec.rb' + - 'spec/requests/api/graphql/project/issues_spec.rb' + - 'spec/requests/api/graphql/project/jira_import_spec.rb' + - 'spec/requests/api/graphql/project/jira_projects_spec.rb' + - 'spec/requests/api/graphql/project/release_spec.rb' + - 'spec/requests/api/graphql/project/releases_spec.rb' + - 'spec/requests/api/group_clusters_spec.rb' + - 'spec/requests/api/group_labels_spec.rb' + - 'spec/requests/api/group_milestones_spec.rb' + - 'spec/requests/api/group_packages_spec.rb' + - 'spec/requests/api/groups_spec.rb' + - 'spec/requests/api/invitations_spec.rb' + - 'spec/requests/api/issues/get_project_issues_spec.rb' + - 'spec/requests/api/labels_spec.rb' + - 'spec/requests/api/members_spec.rb' + - 'spec/requests/api/merge_requests_spec.rb' + - 'spec/requests/api/namespaces_spec.rb' + - 'spec/requests/api/package_files_spec.rb' + - 'spec/requests/api/pages_domains_spec.rb' + - 'spec/requests/api/personal_access_tokens_spec.rb' + - 'spec/requests/api/project_clusters_spec.rb' + - 'spec/requests/api/project_container_repositories_spec.rb' + - 'spec/requests/api/project_events_spec.rb' + - 'spec/requests/api/project_milestones_spec.rb' + - 'spec/requests/api/project_snippets_spec.rb' + - 'spec/requests/api/project_templates_spec.rb' + - 'spec/requests/api/projects_spec.rb' + - 'spec/requests/api/protected_branches_spec.rb' + - 'spec/requests/api/protected_tags_spec.rb' + - 'spec/requests/api/releases_spec.rb' + - 'spec/requests/api/repositories_spec.rb' + - 'spec/requests/api/resource_access_tokens_spec.rb' + - 'spec/requests/api/snippets_spec.rb' + - 'spec/requests/api/tags_spec.rb' + - 'spec/requests/api/templates_spec.rb' + - 'spec/requests/api/todos_spec.rb' + - 'spec/requests/api/topics_spec.rb' + - 'spec/requests/api/unleash_spec.rb' + - 'spec/requests/api/users_spec.rb' + - 'spec/requests/api/v3/github_spec.rb' + - 'spec/requests/groups/autocomplete_sources_spec.rb' + - 'spec/requests/groups/milestones_controller_spec.rb' + - 'spec/requests/jwks_controller_spec.rb' + - 'spec/requests/lfs_http_spec.rb' - 'spec/serializers/ci/dag_pipeline_entity_spec.rb' - 'spec/serializers/ci/pipeline_entity_spec.rb' - 'spec/serializers/diff_file_entity_spec.rb' - 'spec/serializers/stage_entity_spec.rb' + - 'spec/services/ci/compare_test_reports_service_spec.rb' - 'spec/services/ci/pipeline_processing/atomic_processing_service/status_collection_spec.rb' + - 'spec/services/clusters/applications/prometheus_config_service_spec.rb' + - 'spec/services/issues/export_csv_service_spec.rb' - 'spec/services/metrics/dashboard/custom_metric_embed_service_spec.rb' - 'spec/services/projects/participants_service_spec.rb' + - 'spec/support/helpers/api_helpers.rb' + - 'spec/support/helpers/graphql_helpers.rb' + - 'spec/support/matchers/background_migrations_matchers.rb' - 'spec/support/shared_contexts/markdown_golden_master_shared_examples.rb' + - 'spec/support/shared_examples/graphql/mutation_shared_examples.rb' + - 'spec/support/shared_examples/requests/api/container_repositories_shared_examples.rb' + - 'spec/support/shared_examples/requests/api/custom_attributes_shared_examples.rb' + - 'spec/support/shared_examples/requests/api/graphql/packages/group_and_project_packages_list_shared_examples.rb' + - 'spec/support/shared_examples/requests/api/graphql/packages/package_details_shared_examples.rb' + - 'spec/support/shared_examples/requests/api/labels_api_shared_examples.rb' + - 'spec/support/shared_examples/requests/api/milestones_shared_examples.rb' + - 'spec/support/shared_examples/requests/api/notes_shared_examples.rb' + - 'spec/support/shared_examples/requests/api/repository_storage_moves_shared_examples.rb' + - 'spec/support/shared_examples/services/packages_shared_examples.rb' + - 'spec/tooling/docs/deprecation_handling_spec.rb' - 'tooling/danger/sidekiq_queues.rb' + - 'tooling/docs/deprecation_handling.rb' @@ -394,7 +394,7 @@ group :development, :test do # Generate Fake data gem 'ffaker', '~> 2.10' - gem 'spring', '~> 2.1.0' + gem 'spring', '~> 4.1.0' gem 'spring-commands-rspec', '~> 1.0.4' gem 'gitlab-styles', '~> 9.1.0', require: false diff --git a/Gemfile.checksum b/Gemfile.checksum index 7d259f352bf..737a1b6e666 100644 --- a/Gemfile.checksum +++ b/Gemfile.checksum @@ -563,7 +563,7 @@ {"name":"sorted_set","version":"1.0.3","platform":"java","checksum":"996283f2e5c6e838825bcdcee31d6306515ae5f24bcb0ee4ce09dfff32919b8c"}, {"name":"sorted_set","version":"1.0.3","platform":"ruby","checksum":"4f2b8bee6e8c59cbd296228c0f1f81679357177a8b6859dcc2a99e86cce6372f"}, {"name":"spamcheck","version":"1.0.0","platform":"ruby","checksum":"dfeea085184091353e17d729d2f3d714b07cba36aaf64c32dfc35ce9b466fc9c"}, -{"name":"spring","version":"2.1.1","platform":"ruby","checksum":"0d0ccd42eb6ac035b26a6791d10715b3b59c069d1fcd34693d7782257cf85cf4"}, +{"name":"spring","version":"4.1.0","platform":"ruby","checksum":"f17f080fb0df558d663c897a6229ed3d5cc54819ab51876ea6eef49a67f0a3cb"}, {"name":"spring-commands-rspec","version":"1.0.4","platform":"ruby","checksum":"6202e54fa4767452e3641461a83347645af478bf45dddcca9737b43af0dd1a2c"}, {"name":"sprite-factory","version":"1.7.1","platform":"ruby","checksum":"5586524a1aec003241f1abc6852b61433e988aba5ee2b55f906387bf49b01ba2"}, {"name":"sprockets","version":"3.7.2","platform":"ruby","checksum":"5ea1d7facd09203c1aa196afd6178208cd25abdbcc2a9978810a2f0754e152a0"}, diff --git a/Gemfile.lock b/Gemfile.lock index 04df532ab89..4cec2cb098b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1399,7 +1399,7 @@ GEM set (~> 1.0) spamcheck (1.0.0) grpc (~> 1.0) - spring (2.1.1) + spring (4.1.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) sprite-factory (1.7.1) @@ -1837,7 +1837,7 @@ DEPENDENCIES snowplow-tracker (~> 0.6.1) solargraph (~> 0.47.2) spamcheck (~> 1.0.0) - spring (~> 2.1.0) + spring (~> 4.1.0) spring-commands-rspec (~> 1.0.4) sprite-factory (~> 1.7) sprockets (~> 3.7.0) diff --git a/app/assets/javascripts/work_items/components/work_item_description.vue b/app/assets/javascripts/work_items/components/work_item_description.vue index 8111948e55d..3f77f7ad13f 100644 --- a/app/assets/javascripts/work_items/components/work_item_description.vue +++ b/app/assets/javascripts/work_items/components/work_item_description.vue @@ -1,5 +1,5 @@ <script> -import { GlButton, GlFormGroup } from '@gitlab/ui'; +import { GlAlert, GlButton, GlFormGroup } from '@gitlab/ui'; import * as Sentry from '@sentry/browser'; import { helpPagePath } from '~/helpers/help_page_helper'; import { getDraft, clearDraft, updateDraft } from '~/lib/utils/autosave'; @@ -19,6 +19,7 @@ import WorkItemDescriptionRendered from './work_item_description_rendered.vue'; export default { components: { EditedAt, + GlAlert, GlButton, GlFormGroup, MarkdownEditor, @@ -54,6 +55,7 @@ export default { isSubmittingWithKeydown: false, descriptionText: '', descriptionHtml: '', + conflictedDescription: '', }; }, apollo: { @@ -71,8 +73,14 @@ export default { return !this.queryVariables.id && !this.queryVariables.iid; }, result() { - this.descriptionText = this.workItemDescription?.description; - this.descriptionHtml = this.workItemDescription?.descriptionHtml; + if (this.isEditing) { + if (this.descriptionText !== this.workItemDescription?.description) { + this.conflictedDescription = this.workItemDescription?.description; + } + } else { + this.descriptionText = this.workItemDescription?.description; + this.descriptionHtml = this.workItemDescription?.descriptionHtml; + } }, error() { this.$emit('error', i18n.fetchError); @@ -94,6 +102,9 @@ export default { canEdit() { return this.workItem?.userPermissions?.updateWorkItem || false; }, + hasConflicts() { + return Boolean(this.conflictedDescription); + }, tracking() { return { category: TRACKING_CATEGORY_SHOW, @@ -196,6 +207,7 @@ export default { this.isEditing = false; clearDraft(this.autosaveKey); + this.conflictedDescription = ''; } catch (error) { this.$emit('error', error.message); Sentry.captureException(error); @@ -267,17 +279,59 @@ export default { </template> </markdown-field> <div class="gl-display-flex"> - <gl-button - category="primary" - variant="confirm" - :loading="isSubmitting" - data-testid="save-description" - @click="updateWorkItem" - >{{ __('Save') }} - </gl-button> - <gl-button category="tertiary" class="gl-ml-3" data-testid="cancel" @click="cancelEditing" - >{{ __('Cancel') }} - </gl-button> + <gl-alert + v-if="hasConflicts" + :dismissible="false" + variant="danger" + class="gl-w-full" + data-testid="work-item-description-conflicts" + > + <p> + {{ + s__( + "WorkItem|Someone edited the description at the same time you did. If you save it will overwrite their changes. Please confirm you'd like to save your edits.", + ) + }} + </p> + <details class="gl-mb-5"> + <summary class="gl-text-blue-500">{{ s__('WorkItem|View current version') }}</summary> + <textarea + class="note-textarea js-gfm-input js-autosize markdown-area gl-p-3" + readonly + :value="conflictedDescription" + ></textarea> + </details> + <template #actions> + <gl-button + category="primary" + variant="confirm" + :loading="isSubmitting" + data-testid="save-description" + @click="updateWorkItem" + >{{ s__('WorkItem|Save and overwrite') }} + </gl-button> + <gl-button + category="secondary" + class="gl-ml-3" + data-testid="cancel" + @click="cancelEditing" + >{{ s__('WorkItem|Discard changes') }} + </gl-button> + </template> + </gl-alert> + <template v-else> + <gl-button + category="primary" + variant="confirm" + :loading="isSubmitting" + data-testid="save-description" + @click="updateWorkItem" + >{{ __('Save') }} + </gl-button> + <gl-button category="tertiary" class="gl-ml-3" data-testid="cancel" @click="cancelEditing" + >{{ __('Cancel') }} + </gl-button> + </template> </div> </gl-form-group> <work-item-description-rendered diff --git a/app/assets/javascripts/work_items/components/work_item_description_rendered.vue b/app/assets/javascripts/work_items/components/work_item_description_rendered.vue index 2cdff901978..4e9ebef289e 100644 --- a/app/assets/javascripts/work_items/components/work_item_description_rendered.vue +++ b/app/assets/javascripts/work_items/components/work_item_description_rendered.vue @@ -115,6 +115,7 @@ export default { ref="gfm-content" v-safe-html="descriptionHtml" class="md gl-mb-5 gl-min-h-8" + data-testid="work-item-description" @change="toggleCheckboxes" ></div> </div> diff --git a/app/graphql/resolvers/package_details_resolver.rb b/app/graphql/resolvers/package_details_resolver.rb index b77c6b1112b..c565fcb70e3 100644 --- a/app/graphql/resolvers/package_details_resolver.rb +++ b/app/graphql/resolvers/package_details_resolver.rb @@ -11,6 +11,14 @@ module Resolvers description: 'Global ID of the package.' def resolve(id:) + Gitlab::Graphql::Lazy.with_value(find_object(id: id)) do |package| + package if package.default? + end + end + + private + + def find_object(id:) GitlabSchema.find_by_gid(id) end end diff --git a/app/graphql/types/ci/runner_job_execution_status_enum.rb b/app/graphql/types/ci/runner_job_execution_status_enum.rb new file mode 100644 index 00000000000..686ea085199 --- /dev/null +++ b/app/graphql/types/ci/runner_job_execution_status_enum.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Types + module Ci + class RunnerJobExecutionStatusEnum < BaseEnum + graphql_name 'CiRunnerJobExecutionStatus' + + value 'IDLE', + description: "Runner is idle.", + value: :idle, + deprecated: { milestone: '15.7', reason: :alpha } + + value 'RUNNING', + description: 'Runner is executing jobs.', + value: :running, + deprecated: { milestone: '15.7', reason: :alpha } + end + end +end diff --git a/app/graphql/types/ci/runner_type.rb b/app/graphql/types/ci/runner_type.rb index a9c76974850..41c863afc05 100644 --- a/app/graphql/types/ci/runner_type.rb +++ b/app/graphql/types/ci/runner_type.rb @@ -91,6 +91,11 @@ module Types field :owner_project, ::Types::ProjectType, null: true, description: 'Project that owns the runner. For project runners only.', resolver: ::Resolvers::Ci::RunnerOwnerProjectResolver + field :job_execution_status, + Types::Ci::RunnerJobExecutionStatusEnum, + null: true, + description: 'Job execution status of the runner.', + deprecated: { milestone: '15.7', reason: :alpha } markdown_field :maintenance_note_html, null: true @@ -134,6 +139,16 @@ module Types batched_owners(::Ci::RunnerNamespace, Group, :runner_groups, :namespace_id) end + def job_execution_status + BatchLoader::GraphQL.for(runner.id).batch(key: :running_builds_exist) do |runner_ids, loader| + statuses = ::Ci::Runner.id_in(runner_ids).with_running_builds.index_by(&:id) + + runner_ids.each do |runner_id| + loader.call(runner_id, statuses[runner_id] ? :running : :idle) + end + end + end + private def can_admin_runners? diff --git a/app/graphql/types/packages/package_links_type.rb b/app/graphql/types/packages/package_links_type.rb index f16937530b9..eb29fb655bd 100644 --- a/app/graphql/types/packages/package_links_type.rb +++ b/app/graphql/types/packages/package_links_type.rb @@ -12,6 +12,8 @@ module Types field :web_path, GraphQL::Types::String, null: true, description: 'Path to the package details page.' def web_path + return unless object.default? + package_path(object) end end diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index 21cb3f9e06c..7263f792bae 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -67,7 +67,7 @@ module Types end field :package, - description: 'Find a package. This field can only be resolved for one query in any single request.', + description: 'Find a package. This field can only be resolved for one query in any single request. Returns `null` if a package has no `default` status.', resolver: Resolvers::PackageDetailsResolver field :user, Types::UserType, diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index 3be627989b1..d3ceec7ae36 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -69,6 +69,7 @@ module Ci TAG_LIST_MAX_LENGTH = 50 has_many :builds + has_many :running_builds, inverse_of: :runner, class_name: 'Ci::RunningBuild' has_many :runner_projects, inverse_of: :runner, autosave: true, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent has_many :projects, through: :runner_projects, disable_joins: true has_many :runner_namespaces, inverse_of: :runner, autosave: true @@ -89,6 +90,11 @@ module Ci scope :ordered, -> { order(id: :desc) } scope :with_recent_runner_queue, -> { where('contacted_at > ?', recent_queue_deadline) } + scope :with_running_builds, -> do + where('EXISTS(?)', + ::Ci::RunningBuild.select(1) + .where('ci_running_builds.runner_id = ci_runners.id')) + end # BACKWARD COMPATIBILITY: There are needed to maintain compatibility with `AVAILABLE_SCOPES` used by `lib/api/runners.rb` scope :deprecated_shared, -> { instance_type } diff --git a/app/models/hooks/web_hook.rb b/app/models/hooks/web_hook.rb index e57f664f199..7b628de93c3 100644 --- a/app/models/hooks/web_hook.rb +++ b/app/models/hooks/web_hook.rb @@ -187,7 +187,7 @@ class WebHook < ApplicationRecord end # See app/validators/json_schemas/web_hooks_url_variables.json - VARIABLE_REFERENCE_RE = /\{([A-Za-z_][A-Za-z0-9_]+)\}/.freeze + VARIABLE_REFERENCE_RE = /\{([A-Za-z]+[0-9]*(?:[._-][A-Za-z0-9]+)*)\}/.freeze def interpolated_url return url unless url.include?('{') diff --git a/app/views/admin/application_settings/_outbound.html.haml b/app/views/admin/application_settings/_outbound.html.haml index 3505a3bf3ee..1821c8ef4bb 100644 --- a/app/views/admin/application_settings/_outbound.html.haml +++ b/app/views/admin/application_settings/_outbound.html.haml @@ -20,6 +20,6 @@ .form-group = f.gitlab_ui_checkbox_component :dns_rebinding_protection_enabled, s_('OutboundRequests|Enforce DNS rebinding attack protection'), - help_text: _('OutboundRequests|Resolve IP addresses once and uses them to submit requests.') + help_text: s_('OutboundRequests|Resolve IP addresses once and uses them to submit requests.') = f.submit _('Save changes'), pajamas_button: true, data: { qa_selector: 'save_changes_button' } diff --git a/app/views/groups/runners/_settings.html.haml b/app/views/groups/runners/_settings.html.haml index 3e5ec3c26e2..24b2469c501 100644 --- a/app/views/groups/runners/_settings.html.haml +++ b/app/views/groups/runners/_settings.html.haml @@ -3,10 +3,3 @@ - if @group.licensed_feature_available?(:stale_runner_cleanup_for_namespace) .gl-mb-5 #stale-runner-cleanup-form{ data: { group_full_path: @group.full_path, stale_timeout_secs: ::Ci::Runner::STALE_TIMEOUT.to_i } } -= render Pajamas::BannerComponent.new(button_text: s_('Runners|Take me there!'), - button_link: group_runners_path(@group), - svg_path: 'illustrations/rocket-launch-md.svg', - close_options: { class: 'gl-display-none' }) do |c| - - c.title do - = s_('Runners|New group runners view') - %p= s_('Runners|The new view gives you more space and better visibility into your fleet of runners.') diff --git a/app/workers/concerns/waitable_worker.rb b/app/workers/concerns/waitable_worker.rb index 9300c2a5790..f23e3fb20c2 100644 --- a/app/workers/concerns/waitable_worker.rb +++ b/app/workers/concerns/waitable_worker.rb @@ -6,33 +6,8 @@ module WaitableWorker class_methods do # Schedules multiple jobs and waits for them to be completed. def bulk_perform_and_wait(args_list) - # Short-circuit: it's more efficient to do small numbers of jobs inline - if args_list.size == 1 && !always_async_project_authorizations_refresh? - return bulk_perform_inline(args_list) - end - bulk_perform_async(args_list) end - - # Performs multiple jobs directly. Failed jobs will be put into sidekiq so - # they can benefit from retries - def bulk_perform_inline(args_list) - failed = [] - - args_list.each do |args| - worker = new - Gitlab::AppJsonLogger.info(worker.structured_payload(message: 'running inline')) - worker.perform(*args) - rescue StandardError - failed << args - end - - bulk_perform_async(failed) if failed.present? - end - - def always_async_project_authorizations_refresh? - Feature.enabled?(:always_async_project_authorizations_refresh) - end end def perform(*args) diff --git a/config/feature_flags/development/always_async_project_authorizations_refresh.yml b/config/feature_flags/development/always_async_project_authorizations_refresh.yml deleted file mode 100644 index f5ec2473af8..00000000000 --- a/config/feature_flags/development/always_async_project_authorizations_refresh.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: always_async_project_authorizations_refresh -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/92333 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/367683 -milestone: '15.3' -type: development -group: group::workspace -default_enabled: true diff --git a/config/feature_flags/development/enable_minor_delay_during_project_authorizations_refresh.yml b/config/feature_flags/development/enable_minor_delay_during_project_authorizations_refresh.yml index cacc564df73..846052dc76f 100644 --- a/config/feature_flags/development/enable_minor_delay_during_project_authorizations_refresh.yml +++ b/config/feature_flags/development/enable_minor_delay_during_project_authorizations_refresh.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/373672 milestone: '15.4' type: development group: group::workspace -default_enabled: false +default_enabled: true diff --git a/config/feature_flags/development/require_approval_on_scan_removal.yml b/config/feature_flags/development/require_approval_on_scan_removal.yml index 2cbbe8e49f8..fe782dbc27b 100644 --- a/config/feature_flags/development/require_approval_on_scan_removal.yml +++ b/config/feature_flags/development/require_approval_on_scan_removal.yml @@ -5,4 +5,4 @@ rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/382079 milestone: '15.6' type: development group: group::security policies -default_enabled: false +default_enabled: true diff --git a/data/deprecations/16-0-post-ci-lint.yml b/data/deprecations/16-0-post-ci-lint.yml new file mode 100644 index 00000000000..6e7d75b77b0 --- /dev/null +++ b/data/deprecations/16-0-post-ci-lint.yml @@ -0,0 +1,44 @@ +# This is a template for a feature deprecation. +# +# Please refer to the deprecation guidelines to confirm your understanding of the +# definitions for "Deprecation", "End of Support", and "Removal": +# https://docs.gitlab.com/ee/development/deprecation_guidelines/#terminology +# +# Deprecations must be announced at least three releases prior to removal. +# See the OPTIONAL END OF SUPPORT FIELDS section below if an End of Support period also applies. +# +# Breaking changes must happen in a major release. +# +# For more information please refer to the handbook documentation here: +# https://about.gitlab.com/handbook/marketing/blog/release-posts/#deprecations +# +# Please delete this line and above before submitting your merge request. +# +# REQUIRED FIELDS +# +- title: "`POST ci/lint` API endpoint deprecated" # (required) The name of the feature to be deprecated + announcement_milestone: "15.7" # (required) The milestone when this feature was first announced as deprecated. + announcement_date: "2022-11-22" # (required) The date of the milestone release when this feature was first announced as deprecated. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post. + removal_milestone: "16.00" # (required) The milestone when this feature is planned to be removed + removal_date: 2021-03-22 # (required) The date of the milestone release when this feature is planned to be removed. This should almost always be the 22nd of a month (YYYY-MM-22), unless you did an out of band blog post. + breaking_change: true # (required) If this deprecation is a breaking change, set this value to true + reporter: dhershkovitch # (required) GitLab username of the person reporting the deprecation + stage: verify # (required) String value of the stage that the feature was created in. e.g., Growth + issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/381669 # (required) Link to the deprecation issue in GitLab + body: | # (required) Do not modify this line, instead modify the lines below. + The `POST ci/lint` API endpoint is deprecated in 15.7, and will be removed in 16.0. This endpoint does not validate the full range of CI/CD configuration options. Instead, use [`POST /projects/:id/ci/lint`](https://docs.gitlab.com/15.5/ee/api/lint.html#validate-a-ci-yaml-configuration-with-a-namespace), which properly validates CI/CD configuration. +# +# OPTIONAL END OF SUPPORT FIELDS +# +# If an End of Support period applies, the announcement should be shared with GitLab Support +# in the `#spt_managers` channel in Slack, and mention `@gitlab-com/support` in this MR. +# + end_of_support_milestone: # (optional) Use "XX.YY" format. The milestone when support for this feature will end. + end_of_support_date: # (optional) The date of the milestone release when support for this feature will end. + # + # OTHER OPTIONAL FIELDS + # + tiers: # (optional - may be required in the future) An array of tiers that the feature is available in currently. e.g., [Free, Silver, Gold, Core, Premium, Ultimate] + documentation_url: # (optional) This is a link to the current documentation page + image_url: # (optional) This is a link to a thumbnail image depicting the feature + video_url: # (optional) Use the youtube thumbnail URL with the structure of https://img.youtube.com/vi/UNIQUEID/hqdefault.jpg diff --git a/doc/api/graphql/reference/index.md b/doc/api/graphql/reference/index.md index e78167b6db1..3d22277e0f2 100644 --- a/doc/api/graphql/reference/index.md +++ b/doc/api/graphql/reference/index.md @@ -347,7 +347,7 @@ Returns [`Namespace`](#namespace). ### `Query.package` -Find a package. This field can only be resolved for one query in any single request. +Find a package. This field can only be resolved for one query in any single request. Returns `null` if a package has no `default` status. Returns [`PackageDetailsType`](#packagedetailstype). @@ -11012,6 +11012,7 @@ CI/CD variables for a project. | <a id="cirunnerid"></a>`id` | [`CiRunnerID!`](#cirunnerid) | ID of the runner. | | <a id="cirunneripaddress"></a>`ipAddress` | [`String`](#string) | IP address of the runner. | | <a id="cirunnerjobcount"></a>`jobCount` | [`Int`](#int) | Number of jobs processed by the runner (limited to 1000, plus one to indicate that more items exist). | +| <a id="cirunnerjobexecutionstatus"></a>`jobExecutionStatus` **{warning-solid}** | [`CiRunnerJobExecutionStatus`](#cirunnerjobexecutionstatus) | **Introduced** in 15.7. This feature is in Alpha. It can be changed or removed at any time. Job execution status of the runner. | | <a id="cirunnerlocked"></a>`locked` | [`Boolean`](#boolean) | Indicates the runner is locked. | | <a id="cirunnermaintenancenote"></a>`maintenanceNote` | [`String`](#string) | Runner's maintenance notes. | | <a id="cirunnermaintenancenotehtml"></a>`maintenanceNoteHtml` | [`String`](#string) | The GitLab Flavored Markdown rendering of `maintenance_note`. | @@ -16838,6 +16839,7 @@ Represents a product analytics dashboard widget. | <a id="projectissuesenabled"></a>`issuesEnabled` | [`Boolean`](#boolean) | Indicates if Issues are enabled for the current user. | | <a id="projectjiraimportstatus"></a>`jiraImportStatus` | [`String`](#string) | Status of Jira import background job of the project. | | <a id="projectjiraimports"></a>`jiraImports` | [`JiraImportConnection`](#jiraimportconnection) | Jira imports into the project. (see [Connections](#connections)) | +| <a id="projectjitsukey"></a>`jitsuKey` **{warning-solid}** | [`String`](#string) | **Introduced** in 15.7. This feature is in Alpha. It can be changed or removed at any time. Jitsu key assigned to the project. | | <a id="projectjobsenabled"></a>`jobsEnabled` | [`Boolean`](#boolean) | Indicates if CI/CD pipeline jobs are enabled for the current user. | | <a id="projectlanguages"></a>`languages` | [`[RepositoryLanguage!]`](#repositorylanguage) | Programming languages used in the project. | | <a id="projectlastactivityat"></a>`lastActivityAt` | [`Time`](#time) | Timestamp of the project last activity. | @@ -20875,6 +20877,13 @@ Values for YAML processor result. | <a id="cirunneraccesslevelnot_protected"></a>`NOT_PROTECTED` | A runner that is not protected. | | <a id="cirunneraccesslevelref_protected"></a>`REF_PROTECTED` | A runner that is ref protected. | +### `CiRunnerJobExecutionStatus` + +| Value | Description | +| ----- | ----------- | +| <a id="cirunnerjobexecutionstatusidle"></a>`IDLE` **{warning-solid}** | **Introduced** in 15.7. This feature is in Alpha. It can be changed or removed at any time. Runner is idle. | +| <a id="cirunnerjobexecutionstatusrunning"></a>`RUNNING` **{warning-solid}** | **Introduced** in 15.7. This feature is in Alpha. It can be changed or removed at any time. Runner is executing jobs. | + ### `CiRunnerMembershipFilter` Values for filtering runners in namespaces. The previous type name `RunnerMembershipFilter` was deprecated in 15.4. diff --git a/doc/api/packages.md b/doc/api/packages.md index ffdd9fe7d11..6c5cf6bee1e 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -180,7 +180,7 @@ can result in malformed data or broken packages. ## Get a project package -Get a single project package. +Get a single project package. Only packages with status `default` are returned. ```plaintext GET /projects/:id/packages/:package_id @@ -256,7 +256,7 @@ Example response: The `_links` object contains the following properties: -- `web_path`: The path which you can visit in GitLab and see the details of the package. +- `web_path`: The path which you can visit in GitLab and see the details of the package. Only available if the package has status `default`. - `delete_api_path`: The API path to delete the package. Only available if the request user has permission to do so. ## List package files diff --git a/doc/architecture/blueprints/ci_data_decay/pipeline_partitioning.md b/doc/architecture/blueprints/ci_data_decay/pipeline_partitioning.md index 85bf22234b9..6f58b7852a6 100644 --- a/doc/architecture/blueprints/ci_data_decay/pipeline_partitioning.md +++ b/doc/architecture/blueprints/ci_data_decay/pipeline_partitioning.md @@ -180,6 +180,49 @@ respective database tables. Using `RANGE` partitioning works similarly to using of `partition_id` values, using `RANGE` partitioning might be a better strategy. +### Multi-project pipelines + +Parent-child pipeline will always be part of the same partition because child +pipelines are considered a resource of the parent pipeline. They can't be +viewed individually in the project pipeline list page. + +On the other hand, multi-project pipelines can be viewed in the pipeline list page. +They can also be accessed from the pipeline graph as downstream/upstream links +when created via the `trigger` token or the API using a job token. +They can also be created from other pipelines by using trigger tokens, but in this +case we don't store the source pipeline. + +While partitioning `ci_builds` we need to update the foreign keys to the +`ci_sources_pipelines` table: + +```plain +Foreign-key constraints: + "fk_be5624bf37" FOREIGN KEY (source_job_id) REFERENCES ci_builds(id) ON DELETE CASCADE + "fk_d4e29af7d7" FOREIGN KEY (source_pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE + "fk_e1bad85861" FOREIGN KEY (pipeline_id) REFERENCES ci_pipelines(id) ON DELETE CASCADE +``` + +A `ci_sources_pipelines` record references two `ci_pipelines` rows (parent and +the child). Our usual strategy has been to add a `partition_id` to the +table, but if we do it here we will force all multi-project +pipelines to be part of the same partition. + +We should add two `partition_id` columns for this table, a +`partition_id` and a `source_partition_id`: + +```plain +Foreign-key constraints: + "fk_be5624bf37" FOREIGN KEY (source_job_id, source_partition_id) REFERENCES ci_builds(id, source_partition_id) ON DELETE CASCADE + "fk_d4e29af7d7" FOREIGN KEY (source_pipeline_id, source_partition_id) REFERENCES ci_pipelines(id, source_partition_id) ON DELETE CASCADE + "fk_e1bad85861" FOREIGN KEY (pipeline_id, partition_id) REFERENCES ci_pipelines(id, partition_id) ON DELETE CASCADE +``` + +This solution is the closest to a two way door decision because: + +- We retain the ability to reference pipelines in different partitions. +- If we later decide that we want to force multi-project pipelines in the same partition + we could add a constraint to validate that both columns have the same value. + ## Why do we want to use explicit logical partition ids? Partitioning CI/CD data using a logical `partition_id` has several benefits. We diff --git a/doc/development/database/database_dictionary.md b/doc/development/database/database_dictionary.md index bd6dbc54316..474a6cbe093 100644 --- a/doc/development/database/database_dictionary.md +++ b/doc/development/database/database_dictionary.md @@ -11,7 +11,8 @@ locate the feature categories responsible for specific database tables. ## Location -Database dictionary metadata files are stored in the `gitlab` project under `db/docs/`. +Database dictionary metadata files are stored in the `gitlab` project under `db/docs/` for the `main` and `ci` databases. +For the `geo` database, the dictionary files are stored under `ee/db/docs/`. ## Example dictionary file @@ -40,12 +41,14 @@ milestone: '13.0' ## Adding tables -When adding a new table, create a new file under `db/docs/` named -`<table_name>.yml` containing as much information as you know about the table. +When adding a new table, create a new file under `db/docs/` for the `main` and `ci` databases. +For the `geo` database use `ee/db/docs/`. +Name the file as `<table_name>.yml`, containing as much information as you know about the table. Include this file in the commit with the migration that creates the table. ## Dropping tables -When dropping a table, you must remove the metadata file from `db/docs/` -in the same commit with the migration that drops the table. +When dropping a table, you must remove the metadata file from `db/docs/` for `main` and `ci` databases. +For the `geo` database, you must remove the file from `ee/db/docs/`. +Use the same commit with the migration that drops the table. diff --git a/doc/update/deprecations.md b/doc/update/deprecations.md index 8748f992767..12ce638c85b 100644 --- a/doc/update/deprecations.md +++ b/doc/update/deprecations.md @@ -65,6 +65,20 @@ The `gitlab.kas.metrics.port` has been deprecated in favor of the new `gitlab.ka This port is used for much more than just metrics, which warranted this change to avoid confusion in configuration. </div> + +<div class="deprecation removal-1600 breaking-change"> + +### `POST ci/lint` API endpoint deprecated + +Planned removal: GitLab <span class="removal-milestone">16.00</span> (2021-03-22) + +WARNING: +This is a [breaking change](https://docs.gitlab.com/ee/development/deprecation_guidelines/). +Review the details carefully before upgrading. + +The `POST ci/lint` API endpoint is deprecated in 15.7, and will be removed in 16.0. This endpoint does not validate the full range of CI/CD configuration options. Instead, use [`POST /projects/:id/ci/lint`](https://docs.gitlab.com/15.5/ee/api/lint.html#validate-a-ci-yaml-configuration-with-a-namespace), which properly validates CI/CD configuration. + +</div> </div> <div class="announcement-milestone"> diff --git a/doc/user/public_access.md b/doc/user/public_access.md index bdc711f2098..46d96988169 100644 --- a/doc/user/public_access.md +++ b/doc/user/public_access.md @@ -10,7 +10,7 @@ type: reference GitLab allows users with the Owner role to set a project's or group's visibility as: - **Public** -- **Internal** +- **[Internal](#internal-projects-and-groups)** - **Private** These visibility levels affect who can see the project in the public access directory (`/public` @@ -38,7 +38,7 @@ By default, `/public` is visible to unauthenticated users. However, if the [**Public** visibility level](admin_area/settings/visibility_and_access_controls.md#restrict-visibility-levels) is restricted, `/public` is visible only to signed-in users. -## Internal projects and groups +## Internal projects and groups **(FREE SELF)** Internal projects can be cloned by any signed-in user except [external users](permissions.md#external-users). diff --git a/lib/api/entities/package.rb b/lib/api/entities/package.rb index c92a4677220..ab6cc0fcb0a 100644 --- a/lib/api/entities/package.rb +++ b/lib/api/entities/package.rb @@ -26,7 +26,7 @@ module API expose :status, documentation: { type: 'string', example: 'default' } expose :_links do - expose :web_path do |package| + expose :web_path, if: ->(package) { package.default? } do |package| package_path(package) end diff --git a/lib/api/project_packages.rb b/lib/api/project_packages.rb index 99bf0acdd93..158ba7465f4 100644 --- a/lib/api/project_packages.rb +++ b/lib/api/project_packages.rb @@ -69,6 +69,8 @@ module API package = ::Packages::PackageFinder .new(user_project, params[:package_id]).execute + render_api_error!('Package not found', 404) unless package.default? + present package, with: ::API::Entities::Package, user: current_user, namespace: user_project.namespace end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 2d2327ee463..476bed83c0c 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -28485,6 +28485,9 @@ msgstr "" msgid "OnDemandScans|Timezone" msgstr "" +msgid "OnDemandScans|Verify configuration" +msgstr "" + msgid "OnDemandScans|View results" msgstr "" @@ -35364,9 +35367,6 @@ msgstr "" msgid "Runners|Never expires" msgstr "" -msgid "Runners|New group runners view" -msgstr "" - msgid "Runners|New registration token generated!" msgstr "" @@ -35576,12 +35576,6 @@ msgstr "" msgid "Runners|Tags control which type of jobs a runner can handle. By tagging a runner, you make sure shared runners only handle the jobs they are equipped to run." msgstr "" -msgid "Runners|Take me there!" -msgstr "" - -msgid "Runners|The new view gives you more space and better visibility into your fleet of runners." -msgstr "" - msgid "Runners|The project, group or instance where the runner was registered. Instance runners are always owned by Administrator." msgstr "" @@ -36719,6 +36713,9 @@ msgstr "" msgid "SecurityOrchestration|Select a project to store your security policies in. %{linkStart}More information.%{linkEnd}" msgstr "" +msgid "SecurityOrchestration|Select groups" +msgstr "" + msgid "SecurityOrchestration|Select policy" msgstr "" @@ -46452,6 +46449,9 @@ msgstr "" msgid "WorkItem|Delete %{workItemType}" msgstr "" +msgid "WorkItem|Discard changes" +msgstr "" + msgid "WorkItem|Due date" msgstr "" @@ -46521,12 +46521,18 @@ msgstr "" msgid "WorkItem|Requirements" msgstr "" +msgid "WorkItem|Save and overwrite" +msgstr "" + msgid "WorkItem|Search existing %{workItemType}s" msgstr "" msgid "WorkItem|Select type" msgstr "" +msgid "WorkItem|Someone edited the description at the same time you did. If you save it will overwrite their changes. Please confirm you'd like to save your edits." +msgstr "" + msgid "WorkItem|Something went wrong when creating %{workItemType}. Please try again." msgstr "" @@ -46593,6 +46599,9 @@ msgstr "" msgid "WorkItem|Use tasks to break down your work in an issue into smaller pieces. %{learnMoreLink}" msgstr "" +msgid "WorkItem|View current version" +msgstr "" + msgid "WorkItem|Work Items" msgstr "" diff --git a/package.json b/package.json index 7b28a3d557b..37b400455c9 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "@gitlab/at.js": "1.5.7", "@gitlab/favicon-overlay": "2.0.0", "@gitlab/svgs": "3.8.0", - "@gitlab/ui": "49.10.0", + "@gitlab/ui": "49.11.1", "@gitlab/visual-review-tools": "1.7.3", "@gitlab/web-ide": "0.0.1-dev-20221114183058", "@rails/actioncable": "6.1.4-7", diff --git a/scripts/lint-doc-quality.sh b/scripts/lint-doc-quality.sh new file mode 100755 index 00000000000..9d8409a7c80 --- /dev/null +++ b/scripts/lint-doc-quality.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +echo '=> Generating code quality artifact...' +echo + +# Generate code quality artifact for Vale warnings only on changed files. +# Only works on merged results pipelines, so first checks if a merged results CI variable is present. +# If not present, runs on all files. + +if [ -z "${CI_MERGE_REQUEST_TARGET_BRANCH_SHA}" ] +then + MD_DOC_PATH=${MD_DOC_PATH:-doc} + echo "Merge request pipeline (detached) detected. Testing all files." +else + MERGE_BASE=$(git merge-base "${CI_MERGE_REQUEST_TARGET_BRANCH_SHA}" "${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}") + MD_DOC_PATH=$(git diff --diff-filter=d --name-only "${MERGE_BASE}..${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA}" -- 'doc/*.md') + if [ -n "${MD_DOC_PATH}" ] + then + echo -e "Merged results pipeline detected. Testing only the following files: ${MD_DOC_PATH}" + fi +fi + +echo "vale --output=doc/.vale/vale-json.tmpl --minAlertLevel warning ${MD_DOC_PATH} > gl-code-quality-report-docs.json" +vale --output=doc/.vale/vale-json.tmpl --minAlertLevel warning ${MD_DOC_PATH} > gl-code-quality-report-docs.json diff --git a/spec/features/atom/dashboard_issues_spec.rb b/spec/features/atom/dashboard_issues_spec.rb index 855c91f70d7..4e204224773 100644 --- a/spec/features/atom/dashboard_issues_spec.rb +++ b/spec/features/atom/dashboard_issues_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe "Dashboard Issues Feed" do +RSpec.describe "Dashboard Issues Feed", feature_category: :devops_reports do describe "GET /issues" do let!(:user) do user = create(:user, email: 'private1@example.com') diff --git a/spec/features/atom/dashboard_spec.rb b/spec/features/atom/dashboard_spec.rb index 851ae7b02a0..2e9005712bb 100644 --- a/spec/features/atom/dashboard_spec.rb +++ b/spec/features/atom/dashboard_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe "Dashboard Feed" do +RSpec.describe "Dashboard Feed", feature_category: :devops_reports do describe "GET /" do let!(:user) { create(:user, name: "Jonh") } diff --git a/spec/features/atom/issues_spec.rb b/spec/features/atom/issues_spec.rb index 913f5a7bcf3..89db70c6680 100644 --- a/spec/features/atom/issues_spec.rb +++ b/spec/features/atom/issues_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Issues Feed' do +RSpec.describe 'Issues Feed', feature_category: :devops_reports do describe 'GET /issues' do let_it_be_with_reload(:user) do user = create(:user, email: 'private1@example.com') diff --git a/spec/features/atom/merge_requests_spec.rb b/spec/features/atom/merge_requests_spec.rb index 48db8fcbf1e..b9e1c7042b2 100644 --- a/spec/features/atom/merge_requests_spec.rb +++ b/spec/features/atom/merge_requests_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Merge Requests Feed' do +RSpec.describe 'Merge Requests Feed', feature_category: :devops_reports do describe 'GET /merge_requests' do let_it_be_with_reload(:user) { create(:user, email: 'private1@example.com') } let_it_be(:assignee) { create(:user, email: 'private2@example.com') } diff --git a/spec/features/atom/users_spec.rb b/spec/features/atom/users_spec.rb index ab874408e55..b743f900ae7 100644 --- a/spec/features/atom/users_spec.rb +++ b/spec/features/atom/users_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe "User Feed" do +RSpec.describe "User Feed", feature_category: :devops_reports do describe "GET /" do let!(:user) { create(:user) } diff --git a/spec/features/groups/issues_spec.rb b/spec/features/groups/issues_spec.rb index d4e88505118..4a9f0265799 100644 --- a/spec/features/groups/issues_spec.rb +++ b/spec/features/groups/issues_spec.rb @@ -11,6 +11,10 @@ RSpec.describe 'Group issues page' do let(:project_with_issues_disabled) { create(:project, :issues_disabled, group: group) } let(:path) { issues_group_path(group) } + before do + stub_feature_flags(or_issuable_queries: false) + end + context 'with shared examples', :js do let(:issuable) { create(:issue, project: project, title: "this is my created issuable") } diff --git a/spec/features/groups/settings/ci_cd_spec.rb b/spec/features/groups/settings/ci_cd_spec.rb index 50c481c115c..50dee000bac 100644 --- a/spec/features/groups/settings/ci_cd_spec.rb +++ b/spec/features/groups/settings/ci_cd_spec.rb @@ -23,11 +23,6 @@ RSpec.describe 'Group CI/CD settings' do visit group_settings_ci_cd_path(group) end - it 'displays the new group runners view banner' do - expect(page).to have_content(s_('Runners|New group runners view')) - expect(page).to have_link(href: group_runners_path(group)) - end - it 'has "Enable shared runners for this group" toggle', :js do expect(shared_runners_toggle).to have_content(_('Enable shared runners for this group')) end diff --git a/spec/features/groups/user_sees_users_dropdowns_in_issuables_list_spec.rb b/spec/features/groups/user_sees_users_dropdowns_in_issuables_list_spec.rb index 4e4c0e509b0..6f7b2278df5 100644 --- a/spec/features/groups/user_sees_users_dropdowns_in_issuables_list_spec.rb +++ b/spec/features/groups/user_sees_users_dropdowns_in_issuables_list_spec.rb @@ -11,6 +11,7 @@ RSpec.describe 'Groups > User sees users dropdowns in issuables list', :js do let!(:project) { create(:project, group: group) } before do + stub_feature_flags(or_issuable_queries: false) group.add_developer(user_in_dropdown) sign_in(user_in_dropdown) end diff --git a/spec/features/issues/filtered_search/dropdown_base_spec.rb b/spec/features/issues/filtered_search/dropdown_base_spec.rb index 9e3e3d394cd..3270aa24e7f 100644 --- a/spec/features/issues/filtered_search/dropdown_base_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_base_spec.rb @@ -10,6 +10,7 @@ RSpec.describe 'Dropdown base', :js do let_it_be(:issue) { create(:issue, project: project) } before do + stub_feature_flags(or_issuable_queries: false) project.add_maintainer(user) sign_in(user) diff --git a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb index 78450a9c3f7..cdc68084f8f 100644 --- a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb @@ -11,6 +11,7 @@ RSpec.describe 'Dropdown emoji', :js do let_it_be(:award_emoji_star) { create(:award_emoji, name: 'star', user: user, awardable: issue) } before do + stub_feature_flags(or_issuable_queries: false) project.add_maintainer(user) create_list(:award_emoji, 2, user: user, name: 'thumbsup') create_list(:award_emoji, 1, user: user, name: 'thumbsdown') diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb index 0ff56909ad1..c77876541b5 100644 --- a/spec/features/issues/filtered_search/dropdown_label_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb @@ -11,6 +11,7 @@ RSpec.describe 'Dropdown label', :js do let_it_be(:label) { create(:label, project: project, title: 'bug-label') } before do + stub_feature_flags(or_issuable_queries: false) project.add_maintainer(user) sign_in(user) diff --git a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb index 37d604106f1..afaf1b0a45a 100644 --- a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb @@ -12,6 +12,7 @@ RSpec.describe 'Dropdown milestone', :js do let_it_be(:issue) { create(:issue, project: project) } before do + stub_feature_flags(or_issuable_queries: false) project.add_maintainer(user) sign_in(user) diff --git a/spec/features/issues/filtered_search/dropdown_release_spec.rb b/spec/features/issues/filtered_search/dropdown_release_spec.rb index 08e20563c8e..5fa62cacf29 100644 --- a/spec/features/issues/filtered_search/dropdown_release_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_release_spec.rb @@ -12,6 +12,7 @@ RSpec.describe 'Dropdown release', :js do let_it_be(:issue) { create(:issue, project: project) } before do + stub_feature_flags(or_issuable_queries: false) project.add_maintainer(user) sign_in(user) diff --git a/spec/features/labels_hierarchy_spec.rb b/spec/features/labels_hierarchy_spec.rb index 2f22ac8b395..32bc3fb100e 100644 --- a/spec/features/labels_hierarchy_spec.rb +++ b/spec/features/labels_hierarchy_spec.rb @@ -17,6 +17,7 @@ RSpec.describe 'Labels Hierarchy', :js do let!(:project_label_1) { create(:label, project: project_1, title: 'Label_4') } before do + stub_feature_flags(or_issuable_queries: false) grandparent.add_owner(user) sign_in(user) diff --git a/spec/features/profiles/user_edit_profile_spec.rb b/spec/features/profiles/user_edit_profile_spec.rb index 56a70f37779..046c3dc7628 100644 --- a/spec/features/profiles/user_edit_profile_spec.rb +++ b/spec/features/profiles/user_edit_profile_spec.rb @@ -365,7 +365,7 @@ RSpec.describe 'User edit profile' do end end - it 'sets the users status to busy' do + it 'sets the users status to busy', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/382965' do open_user_status_modal busy_status = find('[data-testid="user-availability-checkbox"]') diff --git a/spec/features/work_items/work_item_spec.rb b/spec/features/work_items/work_item_spec.rb index 686b82de868..5c3dab56ef4 100644 --- a/spec/features/work_items/work_item_spec.rb +++ b/spec/features/work_items/work_item_spec.rb @@ -5,11 +5,13 @@ require 'spec_helper' RSpec.describe 'Work item', :js do let_it_be(:project) { create(:project, :public) } let_it_be(:user) { create(:user) } + let_it_be(:other_user) { create(:user) } let_it_be(:work_item) { create(:work_item, project: project) } context 'for signed in user' do before do project.add_developer(user) + project.add_developer(other_user) sign_in(user) @@ -28,6 +30,31 @@ RSpec.describe 'Work item', :js do expect(page).to have_text(user.name) end end + + it 'shows conflict message when description changes', :aggregate_failures do + click_button "Edit description" + scroll_to(find('[aria-label="Description"]')) + + # without this for some reason the test fails when running locally + sleep 1 + + ::WorkItems::UpdateService.new( + project: work_item.project, + current_user: other_user, + params: { description: "oh no!" } + ).execute(work_item) + + work_item.reload + + find('[aria-label="Description"]').send_keys("oh yeah!") + + warning = 'Someone edited the description at the same time you did.' + expect(page.find('[data-testid="work-item-description-conflicts"]')).to have_text(warning) + + click_button "Save and overwrite" + + expect(page.find('[data-testid="work-item-description"]')).to have_text("oh yeah!") + end end end end diff --git a/spec/fixtures/api/schemas/public_api/v4/packages/package.json b/spec/fixtures/api/schemas/public_api/v4/packages/package.json index 5d0d5f63aa9..c1b4fc09079 100644 --- a/spec/fixtures/api/schemas/public_api/v4/packages/package.json +++ b/spec/fixtures/api/schemas/public_api/v4/packages/package.json @@ -28,12 +28,9 @@ }, "_links": { "type": "object", - "required": [ - "web_path" - ], "properties": { - "details": { - "type": "string" + "web_path": { + "type": ["string", "null"] } } }, diff --git a/spec/frontend/work_items/components/work_item_description_spec.js b/spec/frontend/work_items/components/work_item_description_spec.js index 4d7a31fda63..05476ef5ca0 100644 --- a/spec/frontend/work_items/components/work_item_description_spec.js +++ b/spec/frontend/work_items/components/work_item_description_spec.js @@ -111,6 +111,16 @@ describe('WorkItemDescription', () => { }); }); + it('has a subscription', async () => { + createComponent(); + + await waitForPromises(); + + expect(subscriptionHandler).toHaveBeenCalledWith({ + issuableId: workItemQueryResponse.data.workItem.id, + }); + }); + describe('editing description', () => { it('shows edited by text', async () => { const lastEditedAt = '2022-09-21T06:18:42Z'; diff --git a/spec/graphql/types/ci/runner_type_spec.rb b/spec/graphql/types/ci/runner_type_spec.rb index 4ec35db13fb..b078d7f5fac 100644 --- a/spec/graphql/types/ci/runner_type_spec.rb +++ b/spec/graphql/types/ci/runner_type_spec.rb @@ -12,7 +12,7 @@ RSpec.describe GitlabSchema.types['CiRunner'] do id description created_at contacted_at maximum_timeout access_level active paused status version short_sha revision locked run_untagged ip_address runner_type tag_list project_count job_count admin_url edit_admin_url user_permissions executor_name architecture_name platform_name - maintenance_note maintenance_note_html groups projects jobs token_expires_at owner_project + maintenance_note maintenance_note_html groups projects jobs token_expires_at owner_project job_execution_status ] expect(described_class).to include_graphql_fields(*expected_fields) diff --git a/spec/lib/api/entities/package_spec.rb b/spec/lib/api/entities/package_spec.rb index d63ea7833ac..9288f6fe8eb 100644 --- a/spec/lib/api/entities/package_spec.rb +++ b/spec/lib/api/entities/package_spec.rb @@ -32,4 +32,12 @@ RSpec.describe API::Entities::Package do expect(subject[:_links][:web_path]).to match('/infrastructure_registry/') end end + + context 'when package has no default status' do + let(:package) { create(:package, :error) } + + it 'does not expose web_path in _links' do + expect(subject[:_links]).not_to have_key(:web_path) + end + end end diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index 13eb7086586..5b796e57dea 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -701,6 +701,32 @@ RSpec.describe Ci::Runner do it { is_expected.to eq([runner1]) } end + describe '.with_running_builds' do + subject { described_class.with_running_builds } + + let_it_be(:runner1) { create(:ci_runner) } + + context 'with no builds running' do + it { is_expected.to be_empty } + end + + context 'with single build running on runner2' do + let(:runner2) { create(:ci_runner) } + let(:runner3) { create(:ci_runner) } + + before do + project = create(:project, :repository) + pipeline = create(:ci_pipeline, project: project) + build2 = create(:ci_build, runner: runner2, pipeline: pipeline) + create(:ci_running_build, build: build2, project: project, runner: runner2) + build3 = create(:ci_build, runner: runner3, pipeline: pipeline) + create(:ci_running_build, build: build3, project: project, runner: runner3) + end + + it { is_expected.to contain_exactly(runner2, runner3) } + end + end + describe '#matches_build?' do using RSpec::Parameterized::TableSyntax diff --git a/spec/requests/api/graphql/ci/runner_spec.rb b/spec/requests/api/graphql/ci/runner_spec.rb index 94c0a3c41bd..3cc572731ba 100644 --- a/spec/requests/api/graphql/ci/runner_spec.rb +++ b/spec/requests/api/graphql/ci/runner_spec.rb @@ -86,6 +86,7 @@ RSpec.describe 'Query.runner(id)' do 'active' => runner.active, 'paused' => !runner.active, 'status' => runner.status('14.5').to_s.upcase, + 'jobExecutionStatus' => runner.running_builds.any? ? 'RUNNING' : 'IDLE', 'maximumTimeout' => runner.maximum_timeout, 'accessLevel' => runner.access_level.to_s.upcase, 'runUntagged' => runner.run_untagged, @@ -97,8 +98,12 @@ RSpec.describe 'Query.runner(id)' do 'maintenanceNote' => runner.maintenance_note, 'maintenanceNoteHtml' => runner.maintainer_note.present? ? a_string_including('<strong>Test maintenance note</strong>') : '', - 'jobCount' => 0, - 'jobs' => a_hash_including("count" => 0, "nodes" => [], "pageInfo" => anything), + 'jobCount' => runner.running_builds.count, + 'jobs' => a_hash_including( + "count" => runner.running_builds.count, + "nodes" => an_instance_of(Array), + "pageInfo" => anything + ), 'projectCount' => nil, 'adminUrl' => "http://localhost/admin/runners/#{runner.id}", 'userPermissions' => { @@ -179,6 +184,19 @@ RSpec.describe 'Query.runner(id)' do expect(runner_data).not_to include('tagList') end end + + context 'with build running' do + before do + project = create(:project, :repository) + pipeline = create(:ci_pipeline, project: project) + build = create(:ci_build, runner: runner, pipeline: pipeline) + create(:ci_running_build, build: build, project: project, runner: runner) + end + + specify { expect(runner.running_builds.count).to eq 1 } + + it_behaves_like 'runner details fetch' + end end describe 'for project runner' do diff --git a/spec/requests/api/graphql/packages/package_spec.rb b/spec/requests/api/graphql/packages/package_spec.rb index 02a3206f587..db346c41a9d 100644 --- a/spec/requests/api/graphql/packages/package_spec.rb +++ b/spec/requests/api/graphql/packages/package_spec.rb @@ -226,5 +226,16 @@ RSpec.describe 'package details' do end end end + + context 'with package that has no default status' do + before do + composer_package.update!(status: :error) + subject + end + + it "does not return package's details" do + expect(package_details).to be_nil + end + end end end diff --git a/spec/requests/api/project_packages_spec.rb b/spec/requests/api/project_packages_spec.rb index 00d295b3490..5d7266932cb 100644 --- a/spec/requests/api/project_packages_spec.rb +++ b/spec/requests/api/project_packages_spec.rb @@ -350,6 +350,16 @@ RSpec.describe API::ProjectPackages do end end end + + context 'when package has no default status' do + let!(:package1) { create(:npm_package, :error, project: project) } + + it 'returns 404' do + subject + + expect(response).to have_gitlab_http_status(:not_found) + end + end end describe 'DELETE /projects/:id/packages/:package_id' do diff --git a/spec/support/rspec_order_todo.yml b/spec/support/rspec_order_todo.yml index 7886d24ff94..a07f049fbbe 100644 --- a/spec/support/rspec_order_todo.yml +++ b/spec/support/rspec_order_todo.yml @@ -1585,13 +1585,6 @@ - './ee/spec/lib/gitlab/slash_commands/presenters/issue_show_spec.rb' - './ee/spec/lib/gitlab/spdx/catalogue_gateway_spec.rb' - './ee/spec/lib/gitlab/spdx/catalogue_spec.rb' -- './ee/spec/lib/gitlab/status_page/filter/image_filter_spec.rb' -- './ee/spec/lib/gitlab/status_page/filter/mention_anonymization_filter_spec.rb' -- './ee/spec/lib/gitlab/status_page/pipeline/post_process_pipeline_spec.rb' -- './ee/spec/lib/gitlab/status_page_spec.rb' -- './ee/spec/lib/gitlab/status_page/storage/s3_client_spec.rb' -- './ee/spec/lib/gitlab/status_page/storage/s3_multipart_upload_spec.rb' -- './ee/spec/lib/gitlab/status_page/storage_spec.rb' - './ee/spec/lib/gitlab/subscription_portal/clients/graphql_spec.rb' - './ee/spec/lib/gitlab/subscription_portal/client_spec.rb' - './ee/spec/lib/gitlab/subscription_portal/clients/rest_spec.rb' @@ -2011,7 +2004,6 @@ - './ee/spec/models/snippet_spec.rb' - './ee/spec/models/software_license_policy_spec.rb' - './ee/spec/models/software_license_spec.rb' -- './ee/spec/models/status_page/project_setting_spec.rb' - './ee/spec/models/storage_shard_spec.rb' - './ee/spec/models/uploads/local_spec.rb' - './ee/spec/models/upload_spec.rb' @@ -2539,7 +2531,6 @@ - './ee/spec/serializers/security/license_policy_entity_spec.rb' - './ee/spec/serializers/security/vulnerability_report_data_entity_spec.rb' - './ee/spec/serializers/security/vulnerability_report_data_serializer_spec.rb' -- './ee/spec/serializers/status_page/renderer_spec.rb' - './ee/spec/serializers/storage_shard_entity_spec.rb' - './ee/spec/serializers/test_reports_comparer_entity_spec.rb' - './ee/spec/serializers/test_reports_comparer_serializer_spec.rb' @@ -3126,13 +3117,6 @@ - './ee/spec/services/software_license_policies/create_service_spec.rb' - './ee/spec/services/software_license_policies/update_service_spec.rb' - './ee/spec/services/start_pull_mirroring_service_spec.rb' -- './ee/spec/services/status_page/mark_for_publication_service_spec.rb' -- './ee/spec/services/status_page/publish_attachments_service_spec.rb' -- './ee/spec/services/status_page/publish_details_service_spec.rb' -- './ee/spec/services/status_page/publish_list_service_spec.rb' -- './ee/spec/services/status_page/publish_service_spec.rb' -- './ee/spec/services/status_page/trigger_publish_service_spec.rb' -- './ee/spec/services/status_page/unpublish_details_service_spec.rb' - './ee/spec/services/system_notes/epics_service_spec.rb' - './ee/spec/services/system_note_service_spec.rb' - './ee/spec/services/system_notes/escalations_service_spec.rb' @@ -3443,7 +3427,6 @@ - './ee/spec/workers/security/sync_scan_policies_worker_spec.rb' - './ee/spec/workers/security/track_secure_scans_worker_spec.rb' - './ee/spec/workers/set_user_status_based_on_user_cap_setting_worker_spec.rb' -- './ee/spec/workers/status_page/publish_worker_spec.rb' - './ee/spec/workers/store_security_reports_worker_spec.rb' - './ee/spec/workers/sync_seat_link_request_worker_spec.rb' - './ee/spec/workers/sync_seat_link_worker_spec.rb' diff --git a/spec/support/shared_examples/requests/api/graphql/packages/group_and_project_packages_list_shared_examples.rb b/spec/support/shared_examples/requests/api/graphql/packages/group_and_project_packages_list_shared_examples.rb index fb4aacfd7a9..65b40b3b2b8 100644 --- a/spec/support/shared_examples/requests/api/graphql/packages/group_and_project_packages_list_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/graphql/packages/group_and_project_packages_list_shared_examples.rb @@ -62,6 +62,21 @@ RSpec.shared_examples 'group and project packages query' do it 'returns the count of the packages' do expect(packages_count).to eq(4) end + + context '_links' do + let_it_be(:errored_package) { create(:maven_package, :error, project: project1) } + + let(:package_web_paths) { graphql_data_at(resource_type, :packages, :nodes, :_links, :web_path) } + + it 'does not contain the web path of errored package' do + expect(package_web_paths.compact).to contain_exactly( + "/#{project1.full_path}/-/packages/#{npm_package.id}", + "/#{project1.full_path}/-/packages/#{maven_package.id}", + "/#{project2.full_path}/-/packages/#{debian_package.id}", + "/#{project2.full_path}/-/packages/#{composer_package.id}" + ) + end + end end context 'when the user does not have access to the resource' do diff --git a/spec/workers/concerns/waitable_worker_spec.rb b/spec/workers/concerns/waitable_worker_spec.rb index bf156c3b8cb..1449c327052 100644 --- a/spec/workers/concerns/waitable_worker_spec.rb +++ b/spec/workers/concerns/waitable_worker_spec.rb @@ -14,12 +14,6 @@ RSpec.describe WaitableWorker do include ApplicationWorker prepend WaitableWorker - # This is a workaround for a Ruby 2.3.7 bug. rspec-mocks cannot restore - # the visibility of prepended modules. See - # https://github.com/rspec/rspec-mocks/issues/1231 for more details. - def self.bulk_perform_inline(args_list) - end - def perform(count = 0) self.class.counter += count end @@ -37,27 +31,6 @@ RSpec.describe WaitableWorker do worker.bulk_perform_and_wait(arguments) end - - context 'when the feature flag `always_async_project_authorizations_refresh` is turned off' do - before do - stub_feature_flags(always_async_project_authorizations_refresh: false) - end - - it 'inlines the job' do - args_list = [[1]] - expect(worker).to receive(:bulk_perform_inline).with(args_list).and_call_original - expect(Gitlab::AppJsonLogger).to( - receive(:info).with(a_hash_including('message' => 'running inline', - 'class' => 'Gitlab::Foo::Bar::DummyWorker', - 'job_status' => 'running', - 'queue' => 'foo_bar_dummy')) - .once) - - worker.bulk_perform_and_wait(args_list) - - expect(worker.counter).to eq(1) - end - end end context 'between 2 and 3 jobs' do @@ -81,22 +54,6 @@ RSpec.describe WaitableWorker do end end - describe '.bulk_perform_inline' do - it 'runs the jobs inline' do - expect(worker).not_to receive(:bulk_perform_async) - - worker.bulk_perform_inline([[1], [2]]) - - expect(worker.counter).to eq(3) - end - - it 'enqueues jobs if an error is raised' do - expect(worker).to receive(:bulk_perform_async).with([['foo']]) - - worker.bulk_perform_inline([[1], ['foo']]) - end - end - describe '#perform' do shared_examples 'perform' do it 'notifies the JobWaiter when done if the key is provided' do diff --git a/yarn.lock b/yarn.lock index 1a2f200dd15..e6e7d5cb9ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1113,10 +1113,10 @@ resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-3.8.0.tgz#bc7fa51e345e26cff56fdff629ea439adfa1e0cb" integrity sha512-DUWeG2Vx+1ntZ/1GT6S36ZOtXvM5Wm02MtDRrQS4GuOX4rkTeG9aoutSJuwQ2h9BNtxl0U/jkf5GVBxacj18XA== -"@gitlab/ui@49.10.0": - version "49.10.0" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-49.10.0.tgz#54715c18d3e06f313b572c5b9b807622f7a35b19" - integrity sha512-hBkU5TIdc2bzqe4P2X/BZXgQQQa+Sp4A5eWiKK+FVuCx5l1To2q4EyHHPMn292AJx7Y23qM2jP4GMphbs2wtDg== +"@gitlab/ui@49.11.1": + version "49.11.1" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-49.11.1.tgz#ce18f23ac4f48159e8f57f8dedef2f05890a97f2" + integrity sha512-iFhhi03Vrz+wxxUzwVmaaP1s0qeJtACCEpj7xESDVbevjDEqf1muMz/PTH10NslrVbf1VchqNwSC+Ww6C7yAKQ== dependencies: "@popperjs/core" "^2.11.2" bootstrap-vue "2.20.1" |