fix(notifications): mark slice flags as changed after docker secret expansion - #2060
Conversation
…xpansion - Set flag.Changed after sliceValue.Replace in getSecretFromFile - Add additional unit and regression tests
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughSecret-file expansion now marks processed flags as changed, preserves expanded values against environment re-application, and resolves notification secrets during configuration loading. Tests cover precedence, multiline and porcelain inputs, legacy notification secrets, and notifier creation. ChangesSecret File Expansion and Notification Resolution
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 8 |
| Duplication | 28 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #2060 +/- ##
==========================================
- Coverage 72.25% 72.24% -0.02%
==========================================
Files 120 120
Lines 13318 13333 +15
==========================================
+ Hits 9623 9632 +9
- Misses 3271 3279 +8
+ Partials 424 422 -2
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This PR fixes a regression where notification URLs configured via Docker Secrets were passed to Shoutrrr as file paths instead of their contents.
Problem
When
WATCHTOWER_NOTIFICATION_URLpoints to a Docker Secret file, such as/var/secrets/WATCHTOWER_NOTIFICATION_URL, Watchtower reads the file successfully but then creates the Shoutrrr sender with the file path instead of the URL inside it. This results in the notifications process failing to initialize with the following error:Failed to initialize Shoutrrr notifications" error="creating sender with options for URLs [/run/secrets/WATCHTOWER_NOTIFICATION_URL]: error initializing router services: unknown service: \"\"Solution
Set
flag.Changed = trueimmediately after a successfulsliceValue.ReplaceingetSecretFromFile. This signals that the flag value is authoritative, sostringSliceValuereads the expanded pflag value instead of falling back toos.Getenv.Changes
flag.Changed = trueingetSecretFromFileafter slice replacementSummary by CodeRabbit