From 5225ffb5ccfe2fe0e55a3327d43f28f4ed08ae63 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Sun, 14 May 2023 00:07:42 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../error_tracking/components/error_details.vue | 8 ++- .../components/error_details_info.vue | 2 +- .../components/error_tracking_list.vue | 16 ++++- .../javascripts/error_tracking/events_tracking.js | 60 ++++++++++++++++++ app/assets/javascripts/error_tracking/utils.js | 36 ----------- .../details/components/import_details_table.vue | 8 +-- app/models/ci/build_trace.rb | 6 +- .../development/import_details_page.yml | 2 +- .../sign_and_verify_ansi2json_state.yml | 8 --- ..._personal_access_tokens_with_nil_expires_at.yml | 6 ++ ...1082255_add_unique_index_on_ci_runners_token.rb | 20 ------ ...nish_reset_duplicate_ci_runners_token_values.rb | 21 ++++++ ...1082257_add_unique_index_on_ci_runners_token.rb | 18 ++++++ ...d_unique_index_on_ci_runners_token_encrypted.rb | 20 ------ ..._duplicate_ci_runners_token_encrypted_values.rb | 21 ++++++ ...d_unique_index_on_ci_runners_token_encrypted.rb | 18 ++++++ ...p_personal_access_tokens_with_nil_expires_at.rb | 23 +++++++ db/schema_migrations/20221021082255 | 1 - db/schema_migrations/20221021082256 | 1 + db/schema_migrations/20221021082257 | 1 + db/schema_migrations/20221021082312 | 1 - db/schema_migrations/20221021082313 | 1 + db/schema_migrations/20221021082314 | 1 + db/schema_migrations/20230510062503 | 1 + ...p_personal_access_tokens_with_nil_expires_at.rb | 22 +++++++ lib/gitlab/ci/ansi2json.rb | 4 +- lib/gitlab/ci/ansi2json/converter.rb | 8 +-- lib/gitlab/ci/ansi2json/signed_state.rb | 74 ---------------------- lib/gitlab/ci/ansi2json/state.rb | 71 ++++++++++++++++----- .../duplicate_jobs/duplicate_job.rb | 5 +- .../components/error_details_info_spec.js | 2 +- .../components/error_details_spec.js | 11 +++- .../components/error_tracking_list_spec.js | 24 ++++++- .../error_tracking/events_tracking_spec.js | 16 +++++ spec/frontend/error_tracking/utils_spec.js | 16 ----- spec/frontend/import/details/mock_data.js | 6 +- ...sonal_access_tokens_with_nil_expires_at_spec.rb | 38 +++++++++++ spec/lib/gitlab/ci/ansi2json/signed_state_spec.rb | 67 -------------------- spec/lib/gitlab/ci/ansi2json/state_spec.rb | 51 ++++++--------- spec/lib/gitlab/ci/ansi2json_spec.rb | 16 ----- ...sonal_access_tokens_with_nil_expires_at_spec.rb | 26 ++++++++ spec/models/ci/build_trace_spec.rb | 20 ------ 42 files changed, 416 insertions(+), 361 deletions(-) create mode 100644 app/assets/javascripts/error_tracking/events_tracking.js delete mode 100644 app/assets/javascripts/error_tracking/utils.js delete mode 100644 config/feature_flags/development/sign_and_verify_ansi2json_state.yml create mode 100644 db/docs/batched_background_migrations/cleanup_personal_access_tokens_with_nil_expires_at.yml delete mode 100644 db/post_migrate/20221021082255_add_unique_index_on_ci_runners_token.rb create mode 100644 db/post_migrate/20221021082256_finish_reset_duplicate_ci_runners_token_values.rb create mode 100644 db/post_migrate/20221021082257_add_unique_index_on_ci_runners_token.rb delete mode 100644 db/post_migrate/20221021082312_add_unique_index_on_ci_runners_token_encrypted.rb create mode 100644 db/post_migrate/20221021082313_finish_reset_duplicate_ci_runners_token_encrypted_values.rb create mode 100644 db/post_migrate/20221021082314_add_unique_index_on_ci_runners_token_encrypted.rb create mode 100644 db/post_migrate/20230510062503_queue_cleanup_personal_access_tokens_with_nil_expires_at.rb delete mode 100644 db/schema_migrations/20221021082255 create mode 100644 db/schema_migrations/20221021082256 create mode 100644 db/schema_migrations/20221021082257 delete mode 100644 db/schema_migrations/20221021082312 create mode 100644 db/schema_migrations/20221021082313 create mode 100644 db/schema_migrations/20221021082314 create mode 100644 db/schema_migrations/20230510062503 create mode 100644 lib/gitlab/background_migration/cleanup_personal_access_tokens_with_nil_expires_at.rb delete mode 100644 lib/gitlab/ci/ansi2json/signed_state.rb create mode 100644 spec/frontend/error_tracking/events_tracking_spec.js delete mode 100644 spec/frontend/error_tracking/utils_spec.js create mode 100644 spec/lib/gitlab/background_migration/cleanup_personal_access_tokens_with_nil_expires_at_spec.rb delete mode 100644 spec/lib/gitlab/ci/ansi2json/signed_state_spec.rb create mode 100644 spec/migrations/20230510062502_queue_cleanup_personal_access_tokens_with_nil_expires_at_spec.rb diff --git a/app/assets/javascripts/error_tracking/components/error_details.vue b/app/assets/javascripts/error_tracking/components/error_details.vue index 0a661d51576..ccadf940fe3 100644 --- a/app/assets/javascripts/error_tracking/components/error_details.vue +++ b/app/assets/javascripts/error_tracking/components/error_details.vue @@ -17,7 +17,11 @@ import Tracking from '~/tracking'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import TooltipOnTruncate from '~/vue_shared/components/tooltip_on_truncate/tooltip_on_truncate.vue'; import query from '../queries/details.query.graphql'; -import { trackErrorDetailsViewsOptions, trackErrorStatusUpdateOptions } from '../utils'; +import { + trackErrorDetailsViewsOptions, + trackErrorStatusUpdateOptions, + trackCreateIssueFromError, +} from '../events_tracking'; import { severityLevel, severityLevelVariant, errorStatus } from '../constants'; import Stacktrace from './stacktrace.vue'; import ErrorDetailsInfo from './error_details_info.vue'; @@ -184,6 +188,8 @@ export default { ]), createIssue() { this.issueCreationInProgress = true; + const { category, action } = trackCreateIssueFromError; + Tracking.event(category, action); this.$refs.sentryIssueForm.submit(); }, onIgnoreStatusUpdate() { diff --git a/app/assets/javascripts/error_tracking/components/error_details_info.vue b/app/assets/javascripts/error_tracking/components/error_details_info.vue index bbc7b0de7cf..f6f39f178fb 100644 --- a/app/assets/javascripts/error_tracking/components/error_details_info.vue +++ b/app/assets/javascripts/error_tracking/components/error_details_info.vue @@ -2,7 +2,7 @@ import { GlLink, GlIcon, GlCard, GlTooltipDirective } from '@gitlab/ui'; import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; import TrackEventDirective from '~/vue_shared/directives/track_event'; -import { trackClickErrorLinkToSentryOptions } from '../utils'; +import { trackClickErrorLinkToSentryOptions } from '../events_tracking'; const CARD_CLASS = 'gl-mr-7 gl-w-15p gl-min-w-fit-content'; const HEADER_CLASS = diff --git a/app/assets/javascripts/error_tracking/components/error_tracking_list.vue b/app/assets/javascripts/error_tracking/components/error_tracking_list.vue index 2a4bb88b6c2..6750f0f5411 100644 --- a/app/assets/javascripts/error_tracking/components/error_tracking_list.vue +++ b/app/assets/javascripts/error_tracking/components/error_tracking_list.vue @@ -23,7 +23,12 @@ import { __ } from '~/locale'; import Tracking from '~/tracking'; import TimeAgo from '~/vue_shared/components/time_ago_tooltip.vue'; import { sanitizeUrl } from '~/lib/utils/url_utility'; -import { trackErrorListViewsOptions, trackErrorStatusUpdateOptions } from '../utils'; +import { + trackErrorListViewsOptions, + trackErrorStatusUpdateOptions, + trackErrorStatusFilterOptions, + trackErrorSortedByField, +} from '../events_tracking'; import { I18N_ERROR_TRACKING_LIST } from '../constants'; import ErrorTrackingActions from './error_tracking_actions.vue'; @@ -237,8 +242,15 @@ export default { }, filterErrors(status, label) { this.filterValue = label; + const { category, action } = trackErrorStatusFilterOptions(status); + Tracking.event(category, action); return this.filterByStatus(status); }, + sortErrorsByField(field) { + const { category, action } = trackErrorSortedByField(field); + Tracking.event(category, action); + return this.sortByField(field); + }, updateErrosStatus({ errorId, status }) { // eslint-disable-next-line promise/catch-or-return this.updateStatus({ @@ -371,7 +383,7 @@ export default { ({ + category, + action: 'click_error_link_to_sentry', + label: 'Error Link', // eslint-disable-line @gitlab/require-i18n-strings + property: url, +}); + +/** + * Tracks snowplow event when user views error list + */ +export const trackErrorListViewsOptions = { + category, + action: 'view_errors_list', +}; + +/** + * Tracks snowplow event when user views error details + */ +export const trackErrorDetailsViewsOptions = { + category, + action: 'view_error_details', +}; + +/** + * Tracks snowplow event when error status is updated + */ +export const trackErrorStatusUpdateOptions = (status) => ({ + category, + action: `update_${status}_status`, +}); + +/** + * Tracks snowplow event when error list is filter by status + */ +export const trackErrorStatusFilterOptions = (status) => ({ + category, + action: `filter_${status}_status`, +}); + +/** + * Tracks snowplow event when error list is sorted by field + */ +export const trackErrorSortedByField = (field) => ({ + category, + action: `sort_by_${field}`, +}); + +/** + * Tracks snowplow event when the Create Issue button is clicked + */ +export const trackCreateIssueFromError = { + category, + action: 'click_create_issue_from_error', +}; diff --git a/app/assets/javascripts/error_tracking/utils.js b/app/assets/javascripts/error_tracking/utils.js deleted file mode 100644 index afb91d3db51..00000000000 --- a/app/assets/javascripts/error_tracking/utils.js +++ /dev/null @@ -1,36 +0,0 @@ -const category = 'Error Tracking'; // eslint-disable-line @gitlab/require-i18n-strings - -/** - * Tracks snowplow event when User clicks on error link to Sentry - * @param {String} externalUrl that will be send as a property for the event - */ -export const trackClickErrorLinkToSentryOptions = (url) => ({ - category, - action: 'click_error_link_to_sentry', - label: 'Error Link', // eslint-disable-line @gitlab/require-i18n-strings - property: url, -}); - -/** - * Tracks snowplow event when user views error list - */ -export const trackErrorListViewsOptions = { - category, - action: 'view_errors_list', -}; - -/** - * Tracks snowplow event when user views error details - */ -export const trackErrorDetailsViewsOptions = { - category, - action: 'view_error_details', -}; - -/** - * Tracks snowplow event when error status is updated - */ -export const trackErrorStatusUpdateOptions = (status) => ({ - category, - action: `update_${status}_status`, -}); diff --git a/app/assets/javascripts/import/details/components/import_details_table.vue b/app/assets/javascripts/import/details/components/import_details_table.vue index b32b5778265..813dc1f2645 100644 --- a/app/assets/javascripts/import/details/components/import_details_table.vue +++ b/app/assets/javascripts/import/details/components/import_details_table.vue @@ -34,7 +34,7 @@ export default { tdClass: 'gl-md-w-30 gl-word-break-word', }, { - key: 'url', + key: 'provider_url', label: __('URL'), tdClass: 'gl-white-space-nowrap', }, @@ -141,9 +141,9 @@ export default { -