fix(newrelic): set default revision template for notifications
Custom Revision Template for NewRelic Service
Goal
Allow specifying a custom revision template for the NewRelic notification service, which enables support for projects with multiple sources. The default template assumes a specific structure ({{.app.status.operationState.syncResult.revision}}) that doesn't work for all project configurations, especially those with multiple sources.
Changes Made
- Modified the
NewrelicNotification.GetTemplatermethod to use theRevisionfield as a template string when provided by the user - Maintained backward compatibility by keeping the default template when no custom revision is specified
- Aligned the implementation with the pattern used by other fields (
ChangelogandUser) that already support custom templates
Tests Added
Updated TestGetTemplater_Newrelic in newrelic_test.go with two test cases:
- "default revision template" - Tests the original behavior where the default template
{{.app.status.operationState.syncResult.revision}}is used when no custom Revision is provided - "custom revision template" - Tests the new functionality where a custom template specified in the Revision field (
{{.app.status.custom.revision}}) is used instead of the default
These tests verify that users can now configure custom paths to retrieve revision information that matches their specific project structure, including support for multiple sources.
@pasha-codefresh Sorry to ping you directly, can you let me know if there are additional steps I need to take to get this reviewed? This change would really help me, so it would be a shame if it is not reviewed because I miss something.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 60.10%. Comparing base (da04400) to head (49e5bca).
:warning: Report is 19 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #375 +/- ##
==========================================
+ Coverage 55.41% 60.10% +4.68%
==========================================
Files 46 47 +1
Lines 4125 3617 -508
==========================================
- Hits 2286 2174 -112
+ Misses 1511 1097 -414
- Partials 328 346 +18
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.