jiralert icon indicating copy to clipboard operation
jiralert copied to clipboard

Options --reopen-tickets=false and auto_resolve not work as expected

Open avdeev-a opened this issue 1 year ago • 4 comments

Hello team , I use jiralert with docker-compose and here is my config:

jiralert:
        image: jiralert:latest
        volumes:
            - ./config/:/opt/config/
        command:
            - '--config=/opt/config/jiralert.yml'
            - '--reopen-tickets=false'
        ports:
            - 9097:9097
        restart: always

Based on this configuration service should not try to reopen tickets because of --reopen-tickets=false key but I still see this attempts in log file: ts=2023-06-26T22:21:52.147Z caller=dispatch.go:352 level=error component=dispatcher msg="Notify for alerts failed" num_alerts=2 err="jira/webhook[0]: notify retry canceled due to unrecoverable error after 1 attempts: unexpected status code 400: http://jiralert:9097/alert: {\"Error\":true,\"Status\":400,\"Message\":\"JIRA state \\\"Open\\\" does not exist or no transition possible for TASK-842\"}". And one additional thing: it's seems like auto_resolve option not work as well. As you can see in my configuration this option is present but the tickets are still in the open state (with RESOLVED at the title).

---
# Global defaults, applied to all receivers where not explicitly overridden. Optional.
defaults:
  # API access fields.
  api_url: https://jira.example.com
  #user: jiralert
  #password: 'JIRAlert'
  # Alternatively to user and password use a Personal Access Token
  personal_access_token: ''

  # The type of JIRA issue to create. Required.
  issue_type: Task
  # Issue priority. Optional.
  priority: High
  # Go template invocation for generating the summary. Required.
  summary: '{{ template "jira.summary" . }}'
  # Go template invocation for generating the description. Optional.
  description: '{{ template "jira.description" . }}'
  # State to transition into when reopening a closed issue. Required.
  reopen_state: "Open"
  # Do not reopen issues with this resolution. Optional.
  wont_fix_resolution: "Won't Fix"
  # Amount of time after being closed that an issue should be reopened, after which, a new issue is created.
  # Optional (default: always reopen)
  reopen_duration: 0h
  # Static label that will be added to the JIRA ticket alongisde the JIRALERT{...} or ALERT{...} label
  # static_labels: ["custom"]

# Receiver definitions. At least one must be defined.
receivers:
    # Must match the Alertmanager receiver name. Required.
  - name: 'jira'
    # JIRA project to create the issue in. Required.
    project: TASK
    # Copy all Prometheus labels into separate JIRA labels. Optional (default: false).
    add_group_labels: false
    # Will be merged with the static_labels from the default map
    # static_labels: ["anotherLabel"]
    #
    # See https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#setting-custom-field-data-for-other-field-types for further examples.
    # fields:
    #   # TextField
    #   customfield_10001: "Random text"
    #   # SelectList
    #   customfield_10002: {"value": "red"}
    #   # MultiSelect
    #   customfield_10003: [{"value": "red"}, {"value": "blue"}, {"value": "green"}]
    #
    # Automatically resolve jira issues when alert is resolved. Optional. If declared, ensure state is not an empty string.
    auto_resolve:
      state: 'Done' 

# File containing template definitions. Required.
template: jiralert.tmpl

I would be really appreciate for any help.

avdeev-a avatar Jun 26 '23 23:06 avdeev-a

I am also having issues getting Jiralert to auto_resolve a ticket.

zer010gic avatar Sep 14 '23 13:09 zer010gic

I am having the same issue. Anyone got this working?

With exact error as @avdeev-a

sfh-darknet avatar Oct 06 '23 16:10 sfh-darknet

yes auto_resolve works here, one thing which is a bit tricky you have to define a transition and not a state see atl docs here

As far for the error does not exist or no transition possible it gets generated from reopen and resolving issues. I can confirm that the global flag reopen disabled works here fine.

holger-waschke avatar Oct 17 '23 17:10 holger-waschke

Please check the transition naming in you jira. In my case it was reopen_state: "Reopen Issue" https://{myOrg}.atlassian.net//rest/api/2/issue/{issueId}/transitions

VaaFull avatar Mar 13 '24 12:03 VaaFull