Skip to content

fix: Add missing project key to TrackFailedBuild snowplow event

What does this MR do and why?

Adds missing project key to snowplow payload.

See !92637 (comment 1070772729) for context

Tested per https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#test-snowplow-context-against-the-schema

Click to expand testing effort

❯ mkdir -p spec/fixtures/product_intelligence/

❯ mv ~/Downloads/ci_build_failed_schema.json /Users/theoretick/code/gl/gdk/gitlab/spec/fixtures/product_intelligence/ci_build_failed_schema.json

❯ git diff
diff --git a/spec/services/ci/track_failed_build_service_spec.rb b/spec/services/ci/track_failed_build_service_spec.rb
index 676769d2fc7..2b863541be1 100644
--- a/spec/services/ci/track_failed_build_service_spec.rb
+++ b/spec/services/ci/track_failed_build_service_spec.rb
@@ -32,6 +32,7 @@
             project: project.id
           }
         }
+        match_snowplow_context_schema(schema_path: 'ci_build_failed_schema', context: context[:data])

         expect_snowplow_event(
           category: 'ci::build',
❯ be spring rspec spec/services/ci/track_failed_build_service_spec.rb
[TEST PROF INFO] Spring detected
Running via Spring preloader in process 22629
warning: parser/current is loading parser/ruby27, which recognizes2.7.6-compliant syntax, but you are running 2.7.5.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}
==> GitLab Workhorse set up in 18.548441 seconds...

Test environment set up in 26.558583 seconds
..

Finished in 33.06 seconds (files took 29.31 seconds to load)
2 examples, 0 failures

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Original issue: #330551

Edited by Lucas Charles

Merge request reports