jira: allow disabling label updates via labels.enable_update - #5442
jira: allow disabling label updates via labels.enable_update#5442Drenovik wants to merge 1 commit into
Conversation
Support object-form labels with enable_update while keeping the legacy YAML list fully compatible. When enable_update is false, omit labels on PUT so manual/automation labels are not wiped (create still sets labels). Signed-off-by: Drenovik <forget.alphabet071@slmails.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughJira label configuration now supports legacy lists and an object form with ChangesJira label update control
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant JiraNotifier
participant JiraLabelsConfig
participant JiraAPI
JiraNotifier->>JiraLabelsConfig: read Values and EnableUpdateValue()
alt creating an issue
JiraNotifier->>JiraAPI: send creation request with labels
else updating an existing issue
JiraNotifier->>JiraAPI: send update request without labels when updates are disabled
end
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
CodeRabbit’s Docstring Coverage warning is about the new |
What changed
a custom UnmarshalYAML accepts both the legacy labels: [a, b] list and a new object
form labels: { enable_update: false, values: [...] }. EnableUpdateValue() defaults
to true when unset (matches the enable_update pattern already used for
summary/description in Jira Integration: Allow configuring issue update via parameter #4621).
Fields.Labels is set to nil (not an empty slice) so the JSON labels key is omitted
entirely - manually added / automation-added Jira labels are left untouched. Issue
creation (POST) is unaffected and always sets labels.
Why
Every notifier PUT today fully replaces fields.labels, silently wiping labels added by
a human or by Jira automation after issue creation - a known migration issue coming
from jiralert (which never updated labels post-create). This mirrors the existing
enable_update pattern for summary/description (#4621) rather than inventing a new
mechanism.
Backward compatibility
The legacy labels: [a, b] YAML list keeps working unchanged - enable_update defaults
to true, so existing configs see identical behavior (labels are still replaced on
every update, as before). Only configs that opt into the new object form and
explicitly set enable_update: false see a behavior change.
Testing
legacy list unmarshal, object-form unmarshal (both flag values), create always sets
labels, update with enable_update true (labels replaced) and false (labels omitted
from the request body).
list form - confirms no regression in config parsing for existing users.
issue, manually added a label unrelated to the Alertmanager config, then triggered
an update. With enable_update unset (legacy default), the manually added label was
removed (expected baseline, matches current released behavior). With
enable_update: false, the manually added label survived the update.
Pull Request Checklist
Please check all the applicable boxes.
Which user-facing changes does this PR introduce?