From 3a8d221b7e3dc909876fe60ac267e63d1ffffdd7 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 22 Jun 2023 15:09:14 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .rubocop_todo/lint/unused_method_argument.yml | 1 - .rubocop_todo/naming/inclusive_language.yml | 1 - .rubocop_todo/rspec/context_wording.yml | 1 - .../actioncable_connection_monitor.js | 142 ---------- .../javascripts/actioncable_consumer.js | 9 +- .../admin_runners/admin_runners_app.vue | 6 +- .../registration/registration_dropdown.vue | 48 +--- .../components/runner_list_empty_state.vue | 54 +--- app/assets/javascripts/ci/runner/constants.js | 3 - .../group_runners/group_runners_app.vue | 10 +- .../components/lock/issuable_lock_form.vue | 15 +- .../runner_instructions_modal.vue | 15 +- app/controllers/admin/runners_controller.rb | 8 +- app/controllers/groups/runners_controller.rb | 11 +- .../projects/runners_controller.rb | 7 +- .../projects/settings/ci_cd_controller.rb | 1 - app/graphql/mutations/ci/runner/create.rb | 24 -- app/policies/global_policy.rb | 8 - app/policies/group_policy.rb | 8 - app/policies/project_policy.rb | 8 - app/views/profiles/show.html.haml | 243 +++++++++--------- .../runners/_project_runners.html.haml | 26 +- .../create_runner_workflow_for_admin.yml | 8 - .../create_runner_workflow_for_namespace.yml | 8 - ...16181147_service_desk_enabled_projects.yml | 2 +- ...16181122_service_desk_enabled_projects.yml | 2 +- config/redis.yml.example | 6 + .../sidekiq/extra_sidekiq_processes.md | 2 - doc/ci/runners/runners_scope.md | 15 +- doc/development/internal_api/index.md | 4 +- doc/integration/shibboleth.md | 4 +- doc/subscriptions/gitlab_com/index.md | 7 +- doc/subscriptions/self_managed/index.md | 7 +- doc/user/project/push_options.md | 7 + .../discussions_diff/highlight_cache.rb | 6 +- lib/gitlab/error_tracking/error_repository.rb | 7 +- .../active_record_strategy.rb | 117 --------- lib/gitlab/markdown_cache/redis/store.rb | 8 +- lib/gitlab/patch/redis_cache_store.rb | 8 +- lib/gitlab/redis/multi_store.rb | 27 +- locale/gitlab.pot | 6 - .../admin/runners_controller_spec.rb | 26 -- .../groups/runners_controller_spec.rb | 106 ++------ .../projects/runners_controller_spec.rb | 106 ++------ spec/features/admin/admin_runners_spec.rb | 27 +- spec/features/groups/group_runners_spec.rb | 15 -- spec/features/runners_spec.rb | 66 +---- .../actioncable_connection_monitor_spec.js | 79 ------ .../registration_dropdown_spec.js | 33 +-- .../runner_list_empty_state_spec.js | 163 ++++-------- .../group_runners/group_runners_app_spec.js | 29 +-- .../components/task_list_item_actions_spec.js | 6 +- .../components/related_issuable_input_spec.js | 96 +++---- .../lock/issuable_lock_form_spec.js | 8 + .../components/time_tracking/mock_data.js | 13 + .../components/time_tracking/report_spec.js | 57 ++-- .../tokens/crm_contact_token_spec.js | 35 +-- .../tokens/crm_organization_token_spec.js | 33 +-- .../runner_instructions_modal_spec.js | 23 +- .../vue_shared/components/user_select_spec.js | 27 +- .../markdown_cache/redis/extension_spec.rb | 4 +- spec/lib/gitlab/redis/multi_store_spec.rb | 24 ++ spec/policies/global_policy_spec.rb | 54 ---- spec/policies/group_policy_spec.rb | 166 ++++-------- spec/policies/project_policy_spec.rb | 172 +++---------- .../mutations/ci/runner/create_spec.rb | 32 --- .../issue_details_service_spec.rb | 33 ++- .../issue_latest_event_service_spec.rb | 35 ++- .../issue_update_service_spec.rb | 40 ++- .../list_issues_service_spec.rb | 88 ++++++- spec/support/rspec_order_todo.yml | 4 - .../_project_runners.html.haml_spec.rb | 59 +---- 72 files changed, 755 insertions(+), 1804 deletions(-) delete mode 100644 app/assets/javascripts/actioncable_connection_monitor.js delete mode 100644 config/feature_flags/development/create_runner_workflow_for_admin.yml delete mode 100644 config/feature_flags/development/create_runner_workflow_for_namespace.yml delete mode 100644 lib/gitlab/error_tracking/error_repository/active_record_strategy.rb delete mode 100644 spec/frontend/actioncable_connection_monitor_spec.js diff --git a/.rubocop_todo/lint/unused_method_argument.yml b/.rubocop_todo/lint/unused_method_argument.yml index bbd12e608a9..de25c31558f 100644 --- a/.rubocop_todo/lint/unused_method_argument.yml +++ b/.rubocop_todo/lint/unused_method_argument.yml @@ -456,7 +456,6 @@ Lint/UnusedMethodArgument: - 'lib/gitlab/diff/file_collection/merge_request_diff_base.rb' - 'lib/gitlab/diff/line.rb' - 'lib/gitlab/encoding_helper.rb' - - 'lib/gitlab/error_tracking/error_repository/active_record_strategy.rb' - 'lib/gitlab/fogbugz_import/importer.rb' - 'lib/gitlab/git/commit_stats.rb' - 'lib/gitlab/git/conflict/parser.rb' diff --git a/.rubocop_todo/naming/inclusive_language.yml b/.rubocop_todo/naming/inclusive_language.yml index 8950e2e77f4..350df577e09 100644 --- a/.rubocop_todo/naming/inclusive_language.yml +++ b/.rubocop_todo/naming/inclusive_language.yml @@ -79,7 +79,6 @@ Naming/InclusiveLanguage: - 'spec/rubocop/cop/graphql/id_type_spec.rb' - 'spec/services/application_settings/update_service_spec.rb' - 'spec/services/design_management/generate_image_versions_service_spec.rb' - - 'spec/services/error_tracking/list_issues_service_spec.rb' - 'spec/services/projects/download_service_spec.rb' - 'spec/support/import_export/export_file_helper.rb' - 'spec/support/shared_contexts/upload_type_check_shared_context.rb' diff --git a/.rubocop_todo/rspec/context_wording.yml b/.rubocop_todo/rspec/context_wording.yml index bc557ecf4c5..af708ad54e5 100644 --- a/.rubocop_todo/rspec/context_wording.yml +++ b/.rubocop_todo/rspec/context_wording.yml @@ -2670,7 +2670,6 @@ RSpec/ContextWording: - 'spec/services/draft_notes/publish_service_spec.rb' - 'spec/services/environments/schedule_to_delete_review_apps_service_spec.rb' - 'spec/services/environments/stop_service_spec.rb' - - 'spec/services/error_tracking/list_issues_service_spec.rb' - 'spec/services/error_tracking/list_projects_service_spec.rb' - 'spec/services/events/destroy_service_spec.rb' - 'spec/services/feature_flags/update_service_spec.rb' diff --git a/app/assets/javascripts/actioncable_connection_monitor.js b/app/assets/javascripts/actioncable_connection_monitor.js deleted file mode 100644 index fc4e436c7fb..00000000000 --- a/app/assets/javascripts/actioncable_connection_monitor.js +++ /dev/null @@ -1,142 +0,0 @@ -/* eslint-disable no-restricted-globals */ - -import { logger } from '@rails/actioncable'; - -// This is based on https://github.com/rails/rails/blob/5a477890c809d4a17dc0dede43c6b8cef81d8175/actioncable/app/javascript/action_cable/connection_monitor.js -// so that we can take advantage of the improved reconnection logic. We can remove this once we upgrade @rails/actioncable to a version that includes this. - -// Responsible for ensuring the cable connection is in good health by validating the heartbeat pings sent from the server, and attempting -// revival reconnections if things go astray. Internal class, not intended for direct user manipulation. - -const now = () => new Date().getTime(); - -const secondsSince = (time) => (now() - time) / 1000; -class ConnectionMonitor { - constructor(connection) { - this.visibilityDidChange = this.visibilityDidChange.bind(this); - this.connection = connection; - this.reconnectAttempts = 0; - } - - start() { - if (!this.isRunning()) { - this.startedAt = now(); - delete this.stoppedAt; - this.startPolling(); - addEventListener('visibilitychange', this.visibilityDidChange); - logger.log( - `ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`, - ); - } - } - - stop() { - if (this.isRunning()) { - this.stoppedAt = now(); - this.stopPolling(); - removeEventListener('visibilitychange', this.visibilityDidChange); - logger.log('ConnectionMonitor stopped'); - } - } - - isRunning() { - return this.startedAt && !this.stoppedAt; - } - - recordPing() { - this.pingedAt = now(); - } - - recordConnect() { - this.reconnectAttempts = 0; - this.recordPing(); - delete this.disconnectedAt; - logger.log('ConnectionMonitor recorded connect'); - } - - recordDisconnect() { - this.disconnectedAt = now(); - logger.log('ConnectionMonitor recorded disconnect'); - } - - // Private - - startPolling() { - this.stopPolling(); - this.poll(); - } - - stopPolling() { - clearTimeout(this.pollTimeout); - } - - poll() { - this.pollTimeout = setTimeout(() => { - this.reconnectIfStale(); - this.poll(); - }, this.getPollInterval()); - } - - getPollInterval() { - const { staleThreshold, reconnectionBackoffRate } = this.constructor; - const backoff = (1 + reconnectionBackoffRate) ** Math.min(this.reconnectAttempts, 10); - const jitterMax = this.reconnectAttempts === 0 ? 1.0 : reconnectionBackoffRate; - const jitter = jitterMax * Math.random(); - return staleThreshold * 1000 * backoff * (1 + jitter); - } - - reconnectIfStale() { - if (this.connectionIsStale()) { - logger.log( - `ConnectionMonitor detected stale connection. reconnectAttempts = ${ - this.reconnectAttempts - }, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${ - this.constructor.staleThreshold - } s`, - ); - this.reconnectAttempts += 1; - if (this.disconnectedRecently()) { - logger.log( - `ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince( - this.disconnectedAt, - )} s`, - ); - } else { - logger.log('ConnectionMonitor reopening'); - this.connection.reopen(); - } - } - } - - get refreshedAt() { - return this.pingedAt ? this.pingedAt : this.startedAt; - } - - connectionIsStale() { - return secondsSince(this.refreshedAt) > this.constructor.staleThreshold; - } - - disconnectedRecently() { - return ( - this.disconnectedAt && secondsSince(this.disconnectedAt) < this.constructor.staleThreshold - ); - } - - visibilityDidChange() { - if (document.visibilityState === 'visible') { - setTimeout(() => { - if (this.connectionIsStale() || !this.connection.isOpen()) { - logger.log( - `ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`, - ); - this.connection.reopen(); - } - }, 200); - } - } -} - -ConnectionMonitor.staleThreshold = 6; // Server::Connections::BEAT_INTERVAL * 2 (missed two pings) -ConnectionMonitor.reconnectionBackoffRate = 0.15; - -export default ConnectionMonitor; diff --git a/app/assets/javascripts/actioncable_consumer.js b/app/assets/javascripts/actioncable_consumer.js index aeb61e61a3d..5658ffc1a38 100644 --- a/app/assets/javascripts/actioncable_consumer.js +++ b/app/assets/javascripts/actioncable_consumer.js @@ -1,10 +1,3 @@ import { createConsumer } from '@rails/actioncable'; -import ConnectionMonitor from './actioncable_connection_monitor'; -const consumer = createConsumer(); - -if (consumer.connection) { - consumer.connection.monitor = new ConnectionMonitor(consumer.connection); -} - -export default consumer; +export default createConsumer(); diff --git a/app/assets/javascripts/ci/runner/admin_runners/admin_runners_app.vue b/app/assets/javascripts/ci/runner/admin_runners/admin_runners_app.vue index 4d88feebe53..b4590f37ecd 100644 --- a/app/assets/javascripts/ci/runner/admin_runners/admin_runners_app.vue +++ b/app/assets/javascripts/ci/runner/admin_runners/admin_runners_app.vue @@ -126,10 +126,6 @@ export default { isSearchFiltered() { return isSearchFiltered(this.search); }, - shouldShowCreateRunnerWorkflow() { - // create_runner_workflow_for_admin feature flag - return this.glFeatures.createRunnerWorkflowForAdmin; - }, }, watch: { search: { @@ -193,7 +189,7 @@ export default { />
- + {{ s__('Runners|New instance runner') }} -