From c6c658b674a37d73ba2f7d8e5808fe4d67d09919 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 29 Aug 2022 12:09:58 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .../concerns/dependency_proxy/group_access.rb | 2 ++ config/initializers/gitlab_experiment.rb | 2 +- lib/gitlab/tracking.rb | 2 ++ package.json | 4 ++-- .../application_experiment_spec.rb | 12 +++++------ spec/lib/gitlab/tracking_spec.rb | 20 +++++++++++++++++++ yarn.lock | 16 +++++++-------- 7 files changed, 41 insertions(+), 17 deletions(-) diff --git a/app/controllers/concerns/dependency_proxy/group_access.rb b/app/controllers/concerns/dependency_proxy/group_access.rb index 45392625e45..e9fb2563e42 100644 --- a/app/controllers/concerns/dependency_proxy/group_access.rb +++ b/app/controllers/concerns/dependency_proxy/group_access.rb @@ -20,3 +20,5 @@ module DependencyProxy end end end + +DependencyProxy::GroupAccess.prepend_mod_with('DependencyProxy::GroupAccess') diff --git a/config/initializers/gitlab_experiment.rb b/config/initializers/gitlab_experiment.rb index a201a075f62..6d2795caf51 100644 --- a/config/initializers/gitlab_experiment.rb +++ b/config/initializers/gitlab_experiment.rb @@ -65,7 +65,7 @@ Gitlab::Experiment.configure do |config| # permitted, and will be sent along using Gitlab::Tracking::StandardContext. # config.tracking_behavior = lambda do |action, event_args| - Gitlab::Tracking.event(name, action.to_s, **event_args.merge( + Gitlab::Tracking.event(name, action, **event_args.merge( context: (event_args[:context] || []) << SnowplowTracker::SelfDescribingJson.new( 'iglu:com.gitlab/gitlab_experiment/jsonschema/1-0-0', signature ) diff --git a/lib/gitlab/tracking.rb b/lib/gitlab/tracking.rb index 3b46b4c5498..45f836f10d3 100644 --- a/lib/gitlab/tracking.rb +++ b/lib/gitlab/tracking.rb @@ -10,6 +10,8 @@ module Gitlab def event(category, action, label: nil, property: nil, value: nil, context: [], project: nil, user: nil, namespace: nil, **extra) # rubocop:disable Metrics/ParameterLists contexts = [Tracking::StandardContext.new(project: project, user: user, namespace: namespace, **extra).to_context, *context] + action = action.to_s + tracker.event(category, action, label: label, property: property, value: value, context: contexts) rescue StandardError => error Gitlab::ErrorTracking.track_and_raise_for_dev_exception(error, snowplow_category: category, snowplow_action: action) diff --git a/package.json b/package.json index 20eb53f34b4..7f226471c4e 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,8 @@ "@babel/preset-env": "^7.18.2", "@gitlab/at.js": "1.5.7", "@gitlab/favicon-overlay": "2.0.0", - "@gitlab/svgs": "3.1.0", - "@gitlab/ui": "43.7.1", + "@gitlab/svgs": "3.2.0", + "@gitlab/ui": "43.9.1", "@gitlab/visual-review-tools": "1.7.3", "@gitlab/web-ide": "0.0.1-dev-20220815034418", "@rails/actioncable": "6.1.4-7", diff --git a/spec/experiments/application_experiment_spec.rb b/spec/experiments/application_experiment_spec.rb index 20050fae1cb..b144e6f77d2 100644 --- a/spec/experiments/application_experiment_spec.rb +++ b/spec/experiments/application_experiment_spec.rb @@ -129,7 +129,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect_snowplow_event( category: 'namespaced/stub', - action: 'action', + action: :action, property: '_property_', context: [ { @@ -162,7 +162,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect_snowplow_event( category: 'namespaced/stub', - action: 'action', + action: :action, user: user, project: project, namespace: namespace, @@ -177,7 +177,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect_snowplow_event( category: 'namespaced/stub', - action: 'action', + action: :action, user: user, project: project, namespace: group, @@ -193,7 +193,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect_snowplow_event( category: 'namespaced/stub', - action: 'action', + action: :action, user: actor, project: project, namespace: namespace, @@ -208,7 +208,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect_snowplow_event( category: 'namespaced/stub', - action: 'action', + action: :action, project: project, namespace: namespace, context: an_instance_of(Array) @@ -297,7 +297,7 @@ RSpec.describe ApplicationExperiment, :experiment do expect(Gitlab::Tracking).to have_received(:event).with( # rubocop:disable RSpec/ExpectGitlabTracking 'top', - 'nested', + :nested, hash_including(label: 'nested') ) end diff --git a/spec/lib/gitlab/tracking_spec.rb b/spec/lib/gitlab/tracking_spec.rb index 7f30d794aee..e11175c776d 100644 --- a/spec/lib/gitlab/tracking_spec.rb +++ b/spec/lib/gitlab/tracking_spec.rb @@ -145,6 +145,26 @@ RSpec.describe Gitlab::Tracking do end end + context 'when the action is not passed in as a string' do + it 'allows symbols' do + expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception) + + described_class.event('category', :some_action) + end + + it 'allows nil' do + expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception) + + described_class.event('category', nil) + end + + it 'allows integers' do + expect(Gitlab::ErrorTracking).not_to receive(:track_and_raise_for_dev_exception) + + described_class.event('category', 1) + end + end + context 'when destination is Snowplow' do before do allow(Rails.env).to receive(:development?).and_return(true) diff --git a/yarn.lock b/yarn.lock index 0ab35d67ec2..80f3713076d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1051,15 +1051,15 @@ stylelint-declaration-strict-value "1.8.0" stylelint-scss "4.2.0" -"@gitlab/svgs@3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-3.1.0.tgz#0108498a17e2f79d16158015db0be764b406cc09" - integrity sha512-kZ45VTQOgLdwQCLRSj7+aohF+6AUnAaoucR1CFY/6DPDLnNNGeflwsCLN0sFBKwx42HLxFfNwvDmKOMLdSQg5A== +"@gitlab/svgs@3.2.0": + version "3.2.0" + resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-3.2.0.tgz#1ff40355642600e8807775f2b137c184e46380e9" + integrity sha512-djAEmvB3AljQaVKwEoNWls8Q6oWwGvUVrmtBe3ykyPF/E50QVmiM2kXIko2BAEPzmIKhaH9YchowfYqJX3y2vg== -"@gitlab/ui@43.7.1": - version "43.7.1" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-43.7.1.tgz#0550d08ed3312650eb08df9294f25022fe574c64" - integrity sha512-L7Rf+Y2YcsnYFVf95m+8Q2EHXYRh2mbxYCu5S94xoIVUYEBGtiZW7uRsjeEuXZjo1yD54K7e3x9BzBem1onrZw== +"@gitlab/ui@43.9.1": + version "43.9.1" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-43.9.1.tgz#8864687ebaffe3ff71b8d6087ce55e3e52e57a79" + integrity sha512-1Rn4ZEOyQ0flDsAbxsFSnHNFqO0I2kuJjdkXfiEI21g0pdZ3LrdNwE0WcoRZWQd+nQQ0XbvzRaqmxN53rTY21g== dependencies: "@popperjs/core" "^2.11.2" bootstrap-vue "2.20.1"