Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIVIS-3172] use repository name as default test service name #104

Merged

Conversation

anmarchenko
Copy link
Contributor

@anmarchenko anmarchenko commented Jan 15, 2024

What does this PR do?
In order to simplify onboarding for new customers it provides better default service name when none is provided.

Additional Notes

  • last segment of git remote URL is used as a repository name
  • as a fallback, current folder is used (where git repo is located)

How to test the change?
Unit tests are provided.

Example project without service name configured:
https://github.com/anmarchenko/sidekiq/tree/anmarchenko/datadog-ci-visibility

Service is set to repository name:
image

@codecov-commenter
Copy link

codecov-commenter commented Jan 15, 2024

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (c56656c) 99.15% compared to head (f8e5691) 99.11%.
Report is 5 commits behind head on main.

Files Patch % Lines
lib/datadog/ci/utils/git.rb 84.61% 2 Missing ⚠️
...adog/ci/contrib/cucumber/configuration/settings.rb 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #104      +/-   ##
==========================================
- Coverage   99.15%   99.11%   -0.05%     
==========================================
  Files         147      147              
  Lines        6289     6338      +49     
  Branches      264      269       +5     
==========================================
+ Hits         6236     6282      +46     
- Misses         53       56       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@anmarchenko anmarchenko force-pushed the anmarchenko/use_repository_name_as_default_service_name branch from c1de6d6 to 357ca28 Compare January 15, 2024 17:12
@anmarchenko anmarchenko force-pushed the anmarchenko/use_repository_name_as_default_service_name branch from 357ca28 to 0f28e32 Compare January 15, 2024 18:01
@anmarchenko anmarchenko marked this pull request as ready for review January 15, 2024 21:02
@anmarchenko anmarchenko requested review from a team as code owners January 15, 2024 21:02
@@ -21,7 +22,9 @@ class Settings < Datadog::CI::Contrib::Settings

option :service_name do |o|
o.type :string
o.default { Datadog.configuration.service_without_fallback || Ext::DEFAULT_SERVICE_NAME }
o.default do
Datadog.configuration.service_without_fallback || Utils::Git.repository_name || Ext::DEFAULT_SERVICE_NAME

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this come from a function provided by our CI gem's utils, instead of a per-framework "implementation"?

eg: Utils::Something.get_service_name()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I agree, the logic to look into Datadog.configuration and Utils::Git should be extracted, will do it

@anmarchenko anmarchenko changed the title add .repository_name to Utils::Git [CIVIS-3172] use repository name as default test service name Jan 16, 2024
@anmarchenko anmarchenko merged commit eb4dfad into main Jan 16, 2024
26 checks passed
@anmarchenko anmarchenko deleted the anmarchenko/use_repository_name_as_default_service_name branch January 16, 2024 13:53
@github-actions github-actions bot added this to the 0.7.0 milestone Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants