Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
avdeev-a opened this issue Jun 26, 2023 · 4 comments
Open

Comments

@avdeev-a
Copy link

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.

@zer010gic
Copy link

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

@sfh-darknet
Copy link

sfh-darknet commented Oct 6, 2023

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

With exact error as @avdeev-a

@holger-waschke
Copy link
Contributor

holger-waschke commented Oct 17, 2023

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.

@VaaFull
Copy link

VaaFull commented Mar 13, 2024

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

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

No branches or pull requests

5 participants