Skip to content

Conversation

@jpavlav
Copy link
Contributor

@jpavlav jpavlav commented Sep 13, 2025

This PR addresses #87. Atlassian has deprecated the previous search endpoint on their /v2/ api. This PR includes the modified code from the upstream jira python package. It is not possible to simply upgrade the version at this time, because the stable release of st2 is on python3.8. The jira python package that includes this update to the search function requires python3.10 or higher.

Atlassian
Changelog

Pre-patch

id: 68c4d36858dbb201f539580b
action.ref: jira.search_issues
context.user: st2admin
parameters:
  log_level: DEBUG
  query: project = SCOPS ORDER BY created DESC
status: failed (2s elapsed)
start_timestamp: Sat, 13 Sep 2025 02:14:00 UTC
end_timestamp: Sat, 13 Sep 2025 02:14:02 UTC
log:
  - status: requested
    timestamp: '2025-09-13T02:14:00.360000Z'
  - status: scheduled
    timestamp: '2025-09-13T02:14:00.509000Z'
  - status: running
    timestamp: '2025-09-13T02:14:00.544000Z'
  - status: failed
    timestamp: '2025-09-13T02:14:02.406000Z'
result:
  exit_code: 1
  result: None
  stderr: "Traceback (most recent call last):
File
"/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py",
line 395, in <module>
    obj.run()
File
"/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py",
line 214, in run
    output = action.run(**self._parameters)
File "/opt/stackstorm/packs.dev/jira/actions/search_issues.py", line
14, in run
    issues = self._client.search_issues(query, startAt=start_at,
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/jira/client.py",
line 3557, in search_issues
    issues = self._fetch_pages(
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/jira/client.py",
line 817, in _fetch_pages
    resource = self._get_json(
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/jira/client.py",
line 4358, in _get_json
    else self._session.get(url, params=params)
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/requests/sessions.py",
line 602, in get
    return self.request("GET", url, **kwargs)
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/jira/resilientsession.py",
line 247, in request
    elif raise_on_error(response, **processed_kwargs):
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/jira/resilientsession.py",
line 72, in raise_on_error
    raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 410 url:
https://<redacted>.atlassian.net/rest/api/2/search?jql=project+%3D+SCOPS+AND+statusCategory+%21%3D+Done+ORDER+BY+created+DESC&startAt=0&validateQuery=True&fields=%2Aall&maxResults=50
\ttext: The requested API has been removed. Please migrate to the
/rest/api/3/search/jql API. A full migration guideline is available at
https://developer.atlassian.com/changelog/#CHANGE-2046
"
  stdout: ''

Post-patch

id: 68c4e40958dbb201f5395824
action.ref: jira.search_issues
context.user: st2admin
parameters:
  log_level: DEBUG
  query: reporter = currentUser() ORDER BY created DESC
status: succeeded (3s elapsed)
start_timestamp: Sat, 13 Sep 2025 03:24:57 UTC
end_timestamp: Sat, 13 Sep 2025 03:25:00 UTC
log:
  - status: requested
    timestamp: '2025-09-13T03:24:57.308000Z'
  - status: scheduled
    timestamp: '2025-09-13T03:24:57.369000Z'
  - status: running
    timestamp: '2025-09-13T03:24:57.392000Z'
  - status: succeeded
    timestamp: '2025-09-13T03:25:00.296000Z'
result:
  exit_code: 0
  result:
  - assignee: null
    created_at: 2025-08-08T23:39:38.473-0400
    description: 'Test
      '
    id: '1374684'
    key: SCOPS-11111
    labels: []
    priority: Unprioritized
    reporter: Justin Palmer
    resolution: null
    resolved_at: null
    status: To  do
    summary: 'Test
      '
    updated_at: 2025-08-09T03:49:29.881-0400
    url: https://<redacted>.atlassian.net/browse/SCOPS-11111

This PR addresses StackStorm-Exchange#87. Atlassian has deprecated the previous `search`
endpoint on their `/v2/` api. This PR includes the modified code from
the upstream `jira` python package. It is not possible to simply upgrade
the version at this time, because the stable release of `st2` is on
`python3.8`. The `jira` python package that includes this update to the
`search` function requires `python3.10` or higher.

[Atlassian
Changelog](https://developer.atlassian.com/changelog/#CHANGE-2046)

### Pre-patch
```yaml
id: 68c4d36858dbb201f539580b
action.ref: jira.search_issues
context.user: st2admin
parameters:
  log_level: DEBUG
  query: project = SCOPS ORDER BY created DESC
status: failed (2s elapsed)
start_timestamp: Sat, 13 Sep 2025 02:14:00 UTC
end_timestamp: Sat, 13 Sep 2025 02:14:02 UTC
log:
  - status: requested
    timestamp: '2025-09-13T02:14:00.360000Z'
  - status: scheduled
    timestamp: '2025-09-13T02:14:00.509000Z'
  - status: running
    timestamp: '2025-09-13T02:14:00.544000Z'
  - status: failed
    timestamp: '2025-09-13T02:14:02.406000Z'
result:
  exit_code: 1
  result: None
  stderr: "Traceback (most recent call last):
File
"/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py",
line 395, in <module>
    obj.run()
File
"/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py",
line 214, in run
    output = action.run(**self._parameters)
File "/opt/stackstorm/packs.dev/jira/actions/search_issues.py", line
14, in run
    issues = self._client.search_issues(query, startAt=start_at,
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/jira/client.py",
line 3557, in search_issues
    issues = self._fetch_pages(
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/jira/client.py",
line 817, in _fetch_pages
    resource = self._get_json(
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/jira/client.py",
line 4358, in _get_json
    else self._session.get(url, params=params)
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/requests/sessions.py",
line 602, in get
    return self.request("GET", url, **kwargs)
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/jira/resilientsession.py",
line 247, in request
    elif raise_on_error(response, **processed_kwargs):
File
"/opt/stackstorm/virtualenvs/jira/lib/python3.8/site-packages/jira/resilientsession.py",
line 72, in raise_on_error
    raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 410 url:
https://<redacted>.atlassian.net/rest/api/2/search?jql=project+%3D+SCOPS+AND+statusCategory+%21%3D+Done+ORDER+BY+created+DESC&startAt=0&validateQuery=True&fields=%2Aall&maxResults=50
\ttext: The requested API has been removed. Please migrate to the
/rest/api/3/search/jql API. A full migration guideline is available at
https://developer.atlassian.com/changelog/#CHANGE-2046
"
  stdout: ''
```

### Post-patch
```yaml
id: 68c4e40958dbb201f5395824
action.ref: jira.search_issues
context.user: st2admin
parameters:
  log_level: DEBUG
  query: reporter = currentUser() ORDER BY created DESC
status: succeeded (3s elapsed)
start_timestamp: Sat, 13 Sep 2025 03:24:57 UTC
end_timestamp: Sat, 13 Sep 2025 03:25:00 UTC
log:
  - status: requested
    timestamp: '2025-09-13T03:24:57.308000Z'
  - status: scheduled
    timestamp: '2025-09-13T03:24:57.369000Z'
  - status: running
    timestamp: '2025-09-13T03:24:57.392000Z'
  - status: succeeded
    timestamp: '2025-09-13T03:25:00.296000Z'
result:
  exit_code: 0
  result:
  - assignee: null
    created_at: 2025-08-08T23:39:38.473-0400
    description: 'Test
      '
    id: '1374684'
    key: SCOPS-11111
    labels: []
    priority: Unprioritized
    reporter: Justin Palmer
    resolution: null
    resolved_at: null
    status: To  do
    summary: 'Test
      '
    updated_at: 2025-08-09T03:49:29.881-0400
    url: https://<redacted>.atlassian.net/browse/SCOPS-11111
```
@jpavlav jpavlav requested review from a team and floatingstatic as code owners September 13, 2025 03:38
@jpavlav jpavlav requested review from winem and removed request for a team September 13, 2025 03:38
Copy link
Collaborator

@floatingstatic floatingstatic left a comment

Choose a reason for hiding this comment

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

@jpavlav thanks, looks good to me! I'll make a note that we can look at potentially reverting parts of this after st2 3.9 release

@floatingstatic floatingstatic merged commit 9c2a196 into StackStorm-Exchange:master Sep 15, 2025
3 checks passed
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.

2 participants