Repository navigation
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 |
|
@holger-waschke Could you have a look at this PR? Does it make sense? |
I think this is a useful enhancement to the existing Jira notifier behavior. Currently, updating an issue replaces the complete labels array, which can unintentionally remove labels added manually or by Jira automation. Being able to omit labels from update requests avoids that problem. summary:
enable_update: true
description:
enable_update: true
labels:
enable_update: false
values:
- alertmanagerWith this configuration, Alertmanager still adds its labels when creating the issue, but preserves the issue’s existing labels on subsequent updates. The PR now needs rebasing because its tests no longer compile against current main , although the implementation itself applies cleanly. |
|
Thanks @holger-waschke and @SoloJacobs for taking a look. Happy to rebase — just want to check first: is the rebase expected from me, or is there something on your end before that? Also want to make sure it's not for nothing — it took a while to get reviewed, and in that gap main moved on and the branch drifted out of sync, which is why it needs rebasing now. If we can agree here that this is good to merge, I'll rebase right away so we don't end up back in the same spot. Also, #5443 is a direct extension of this one (adds |
|
Hi @Drenovik , my plan is to give this a thorough review, and then it is hopefully ready to land. We just have a lot to do within the project. So, no action required on your side. Kind regards |
|
And for your second PR: I have really not looked at that feature yet. We also need the sign-off from other maintainers here, and there is a chance we might reject it. So, keep it separate from this one. |
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?