Skip to content

Commit 4bcfe50

Browse files
committed
[SPARK-29731][INFRA] Use public JIRA REST API to read-only access
### What changes were proposed in this pull request? This PR replaces `jira_client` API call for read-only access with public Apache JIRA REST API invocation. ### Why are the changes needed? This will reduce the number of authenticated API invocations. I hope this will reduce the chance of CAPCHAR from Apache JIRA site. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? Manual. ``` $ echo 26375 > .github-jira-max $ dev/github_jira_sync.py Read largest PR number previously seen: 26375 Retrieved 100 JIRA PR's from Github 1 PR's remain after excluding visted ones Checking issue SPARK-29731 Writing largest PR number seen: 26376 Build PR dictionary SPARK-29731 26376 Set 26376 with labels "PROJECT INFRA" ``` Closes apache#26376 from dongjoon-hyun/SPARK-29731. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 1ac6bd9 commit 4bcfe50

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

dev/github_jira_sync.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ def build_pr_component_dic(jira_prs):
116116
dic = {}
117117
for issue, pr in jira_prs:
118118
print(issue)
119-
jira_components = [c.name.upper() for c in jira_client.issue(issue).fields.components]
119+
page = get_json(get_url(JIRA_API_BASE + "/rest/api/2/issue/" + issue))
120+
jira_components = [c['name'].upper() for c in page['fields']['components']]
120121
if pr['number'] in dic:
121122
dic[pr['number']][1].update(jira_components)
122123
else:
@@ -163,7 +164,8 @@ def reset_pr_labels(pr_num, jira_components):
163164
url = pr['html_url']
164165
title = "[Github] Pull Request #%s (%s)" % (pr['number'], pr['user']['login'])
165166
try:
166-
existing_links = map(lambda l: l.raw['object']['url'], jira_client.remote_links(issue))
167+
page = get_json(get_url(JIRA_API_BASE + "/rest/api/2/issue/" + issue + "/remotelink"))
168+
existing_links = map(lambda l: l['object']['url'], page)
167169
except:
168170
print("Failure reading JIRA %s (does it exist?)" % issue)
169171
print(sys.exc_info()[0])

0 commit comments

Comments
 (0)