From 908b459a21b3d84315c630d7b66dad48d8dfa166 Mon Sep 17 00:00:00 2001 From: Stewart Thomson Date: Mon, 15 Sep 2025 12:50:09 +0200 Subject: [PATCH] fix_jira: - update go-jira to resolve deprecated endpoint Signed-off-by: Stewart Thomson --- go.mod | 2 +- go.sum | 4 ++-- pkg/notify/notify.go | 6 +++--- pkg/notify/notify_test.go | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 4e2102d6..4945ebe6 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/prometheus-community/jiralert go 1.23.0 require ( - github.com/andygrunwald/go-jira v1.16.0 + github.com/andygrunwald/go-jira v1.16.1 github.com/go-kit/log v0.2.1 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.22.0 diff --git a/go.sum b/go.sum index c56e1fce..f975e7b2 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/andygrunwald/go-jira v1.16.0 h1:PU7C7Fkk5L96JvPc6vDVIrd99vdPnYudHu4ju2c2ikQ= -github.com/andygrunwald/go-jira v1.16.0/go.mod h1:UQH4IBVxIYWbgagc0LF/k9FRs9xjIiQ8hIcC6HfLwFU= +github.com/andygrunwald/go-jira v1.16.1 h1:WoQEar5XoDRAibOgKzTFELlPNlKAtnfWr296R9zdFLA= +github.com/andygrunwald/go-jira v1.16.1/go.mod h1:UQH4IBVxIYWbgagc0LF/k9FRs9xjIiQ8hIcC6HfLwFU= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= diff --git a/pkg/notify/notify.go b/pkg/notify/notify.go index 46cb5b71..2284b26f 100644 --- a/pkg/notify/notify.go +++ b/pkg/notify/notify.go @@ -35,7 +35,7 @@ import ( // TODO(bwplotka): Consider renaming this package to ticketer. type jiraIssueService interface { - Search(jql string, options *jira.SearchOptions) ([]jira.Issue, *jira.Response, error) + SearchV2JQL(jql string, options *jira.SearchOptionsV2) ([]jira.Issue, *jira.Response, error) GetTransitions(id string) ([]jira.Transition, *jira.Response, error) Create(issue *jira.Issue) (*jira.Issue, *jira.Response, error) @@ -330,13 +330,13 @@ func (r *Receiver) search(projects []string, issueLabel string) (*jira.Issue, bo // Search multiple projects in case issue was moved and further alert firings are desired in existing JIRA. projectList := "'" + strings.Join(projects, "', '") + "'" query := fmt.Sprintf("project in(%s) and labels=%q order by resolutiondate desc", projectList, issueLabel) - options := &jira.SearchOptions{ + options := &jira.SearchOptionsV2{ Fields: []string{"summary", "priority", "status", "resolution", "resolutiondate", "description", "comment"}, MaxResults: 2, } level.Debug(r.logger).Log("msg", "search", "query", query, "options", fmt.Sprintf("%+v", options)) - issues, resp, err := r.client.Search(query, options) + issues, resp, err := r.client.SearchV2JQL(query, options) if err != nil { retry, err := handleJiraErrResponse("Issue.Search", resp, err, r.logger) return nil, retry, err diff --git a/pkg/notify/notify_test.go b/pkg/notify/notify_test.go index 7aee66a9..8f52127b 100644 --- a/pkg/notify/notify_test.go +++ b/pkg/notify/notify_test.go @@ -52,7 +52,7 @@ func newTestFakeJira() *fakeJira { } } -func (f *fakeJira) Search(jql string, options *jira.SearchOptions) ([]jira.Issue, *jira.Response, error) { +func (f *fakeJira) SearchV2JQL(jql string, options *jira.SearchOptionsV2) ([]jira.Issue, *jira.Response, error) { var issues []jira.Issue for _, key := range f.keysByQuery[jql] { issue := jira.Issue{Key: key, Fields: &jira.IssueFields{}}