Skip to content

jira integration template customfields#4029

Merged
SuperQ merged 1 commit intoprometheus:mainfrom
holger-waschke:hwa/add_jira_template_custom_fields
Nov 3, 2025
Merged

jira integration template customfields#4029
SuperQ merged 1 commit intoprometheus:mainfrom
holger-waschke:hwa/add_jira_template_custom_fields

Conversation

@holger-waschke
Copy link
Contributor

@holger-waschke holger-waschke commented Sep 17, 2024

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 holger-waschke force-pushed the hwa/add_jira_template_custom_fields branch from a55ee26 to 3c16236 Compare September 18, 2024 11:29
@jkroepke
Copy link
Member

jkroepke commented Sep 30, 2024

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

@holger-waschke holger-waschke force-pushed the hwa/add_jira_template_custom_fields branch from 40cf69c to 1864d6c Compare October 7, 2024 14:43
@holger-waschke holger-waschke force-pushed the hwa/add_jira_template_custom_fields branch 2 times, most recently from 5fab22c to a6f0147 Compare October 7, 2024 15:27
@holger-waschke
Copy link
Contributor Author

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

Copy link
Member

@jkroepke jkroepke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - but I'm not an official maintainer.

@jkroepke
Copy link
Member

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

@holger-waschke
Copy link
Contributor Author

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

@holger-waschke holger-waschke force-pushed the hwa/add_jira_template_custom_fields branch 2 times, most recently from 15b7215 to a8c416f Compare November 12, 2024 10:41
@holger-waschke
Copy link
Contributor Author

@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
Copy link
Contributor Author

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

@k0ste
Copy link

k0ste commented Jan 30, 2025

Closes #4110

@holger-waschke
Copy link
Contributor Author

@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 holger-waschke force-pushed the hwa/add_jira_template_custom_fields branch 2 times, most recently from 44c3ccd to 47f254c Compare June 23, 2025 17:28
@heliapb
Copy link
Contributor

heliapb commented Oct 15, 2025

Hi any prediction on this getting merged? thanks

@holger-waschke
Copy link
Contributor Author

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

@SuperQ
Copy link
Member

SuperQ commented Oct 29, 2025

Looks like there are some Go linting issues to fix.

@holger-waschke holger-waschke force-pushed the hwa/add_jira_template_custom_fields branch 4 times, most recently from 9927eba to e3f1e7d Compare November 1, 2025 13:12
@holger-waschke holger-waschke force-pushed the hwa/add_jira_template_custom_fields branch from e3f1e7d to e073bbb Compare November 1, 2025 13:13
@holger-waschke
Copy link
Contributor Author

holger-waschke commented Nov 1, 2025

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

…fields

Signed-off-by: Holger Waschke <holger.waschke@dvag.com>
@holger-waschke holger-waschke force-pushed the hwa/add_jira_template_custom_fields branch from 87e74bb to 38ae3df Compare November 1, 2025 13:40
Copy link
Contributor

@Spaceman1701 Spaceman1701 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the small refactor and new tests, this LGTM.

I think the behavior of DeepCopyWithTemplate is a little strange, but it's practical, so let's go for it 👍

@SuperQ SuperQ merged commit c94cdfd into prometheus:main Nov 3, 2025
7 checks passed
@heliapb
Copy link
Contributor

heliapb commented Nov 3, 2025

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

@SoloJacobs SoloJacobs mentioned this pull request Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants