alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

jira integration template customfields

Open holger-waschke opened this issue 1 year ago • 2 comments

We using templates to fill the jira customfields, e.g.

{{- define "asp.priority" -}}
  {{- with index .Alerts 0 -}}
    {{- if .Labels.severity -}}
      {{- if eq .Labels.severity "disaster" -}}
        Sehr Hoch
        {{- else if eq .Labels.severity "critical" -}}
          Mittel
        {{- else if eq .Labels.severity "warning" -}}
          Mittel
        {{- else if eq .Labels.severity "standard" -}}
          Mittel
        {{- else -}}
          Mittel
      {{- end -}}
      {{- else -}}
        Mittel
    {{- end -}}
  {{- end -}}
{{- end -}}

This code changes templates the custom fields before creating the issue, so we can use templates for custom fields

- name: test
  jira_configs:
  - project: Epic
    issue_type: Alarm
    fields:
      customfield_14400: '{{ template "jira.host" . }}'
    http_config:
      authorization:
        credentials: 

holger-waschke avatar Sep 17 '24 14:09 holger-waschke

Damn, seems like I forgot that. I would recommend to extend the tests.

jkroepke avatar Sep 30 '24 20:09 jkroepke

Damn, seems like I forgot that. I would recommend to extend the tests.

No problem, I added a new template jira.host for the unit tests, please tell me if youre fine with this. otherwise we could use some existing template to test the customfields but I think with the new template it´s cleaner

holger-waschke avatar Oct 07 '24 15:10 holger-waschke

@simonpasquier is there any chance to get this in 0.28?

jkroepke avatar Oct 25 '24 07:10 jkroepke

I´ll fix the merge conflicts If the maintainer confirm this to be merged.

holger-waschke avatar Nov 06 '24 08:11 holger-waschke

@simonpasquier I fixed the merge conflicts, would be highly appreciated to get this into main as we need this feature in our production environment.

holger-waschke avatar Nov 12 '24 10:11 holger-waschke

could someone have a look at the unit test TestClusterVSInstance, as im not able to reproduce this failure.

holger-waschke avatar Nov 12 '24 10:11 holger-waschke

Closes #4110

k0ste avatar Jan 30 '25 12:01 k0ste

@simonpasquier could you have a look into this PR?

As we´re migration to Jira Cloud we really need to have the ability to use templated custom jira fields.

holger-waschke avatar Jun 23 '25 10:06 holger-waschke

Hi any prediction on this getting merged? thanks

heliapb avatar Oct 15 '25 14:10 heliapb

Hey @sysadmind any chance of this getting merged? We´re running this code in a production environment without any problems. Would be great to use the official version again and not a fork. I have one more improvement to the Jira Integration coming and then we could switch to the official version

holger-waschke avatar Oct 20 '25 10:10 holger-waschke

Looks like there are some Go linting issues to fix.

SuperQ avatar Oct 29 '25 16:10 SuperQ

Moved the DeepCopyWithTemplate function to template.go and improved its unit tests.

holger-waschke avatar Nov 01 '25 13:11 holger-waschke

Thank you guys, hope this can come in a new release soon 🤞

heliapb avatar Nov 03 '25 20:11 heliapb