Skip to content

Commit

Permalink
apacheGH-44948: [Dev][Archery] Remove JIRA remnants from Archery (apa…
Browse files Browse the repository at this point in the history
…che#45091)

### Rationale for this change

We are not using JIRA as issue tracker anymore, we should remove it from archery.

### What changes are included in this PR?

Remove Jira dependency from archery and related code mainly for release curate for release changelog generation.

### Are these changes tested?

Yes, archery tests are still successful and I've validated that I can generate:
`archery release curate 18.0.0` and `archery release curate 19.0.0` successfully.
I haven't tested cherry-picking but there doesn't seem to be code involved and we have been able to cherry-pick during the last releases.

### Are there any user-facing changes?
No
* GitHub Issue: apache#44948

Authored-by: Raúl Cumplido <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
raulcd authored Dec 20, 2024
1 parent 02a1659 commit 5293379
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 81 deletions.
50 changes: 5 additions & 45 deletions dev/archery/archery/release/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

from git import Repo
from github import Github
from jira import JIRA
from semver import VersionInfo as SemVer

from ..utils.source import ArrowSources
Expand All @@ -50,14 +49,6 @@ def __init__(self, released=False, release_date=None, **kwargs):
def parse(cls, version, **kwargs):
return cls(**SemVer.parse(version).to_dict(), **kwargs)

@classmethod
def from_jira(cls, jira_version):
return cls.parse(
jira_version.name,
released=jira_version.released,
release_date=getattr(jira_version, 'releaseDate', None)
)

@classmethod
def from_milestone(cls, milestone):
return cls.parse(
Expand All @@ -76,14 +67,6 @@ def __init__(self, key, type, summary, github_issue=None):
self.github_issue_id = getattr(github_issue, "number", None)
self._github_issue = github_issue

@classmethod
def from_jira(cls, jira_issue):
return cls(
key=jira_issue.key,
type=jira_issue.fields.issuetype.name,
summary=jira_issue.fields.summary
)

@classmethod
def from_github(cls, github_issue):
return cls(
Expand Down Expand Up @@ -117,15 +100,6 @@ def is_pr(self):
return bool(self._github_issue and self._github_issue.pull_request)


class Jira(JIRA):

def __init__(self, url='https://issues.apache.org/jira'):
super().__init__(url)

def issue(self, key):
return Issue.from_jira(super().issue(key))


class IssueTracker:

def __init__(self, github_token=None):
Expand Down Expand Up @@ -401,10 +375,6 @@ def commits(self):
commit_range = f"{lower}..{upper}"
return list(map(Commit, self.repo.iter_commits(commit_range)))

@cached_property
def jira_instance(self):
return Jira()

@cached_property
def default_branch(self):
default_branch_name = os.getenv("ARCHERY_DEFAULT_BRANCH")
Expand Down Expand Up @@ -459,20 +429,12 @@ def curate(self, minimal=False):
else:
outside.append(
(self.issue_tracker.issue(int(c.issue_id)), c))
elif c.project == 'ARROW':
if c.issue in release_issues:
within.append((release_issues[c.issue], c))
else:
outside.append((self.jira_instance.issue(c.issue), c))
elif c.project == 'PARQUET':
parquet.append((self.jira_instance.issue(c.issue), c))
else:
warnings.warn(
f'Issue {c.issue} does not pertain to GH' +
', ARROW or PARQUET')
f'Issue {c.issue} does not pertain to GH')
outside.append((c.issue, c))

# remaining jira tickets
# remaining tickets
within_keys = {i.key for i, c in within}
# Take into account that some issues milestoned are prs
nopatch = [issue for key, issue in release_issues.items()
Expand All @@ -488,12 +450,10 @@ def changelog(self):
# get organized report for the release
curation = self.curate()

# jira tickets having patches in the release
# issues having patches in the release
issue_commit_pairs.extend(curation.within)
# parquet patches in the release
issue_commit_pairs.extend(curation.parquet)

# jira tickets without patches
# issues without patches
for issue in curation.nopatch:
issue_commit_pairs.append((issue, None))

Expand Down Expand Up @@ -576,7 +536,7 @@ def cherry_pick_commits(self, recreate_branch=True):
logger.info(f"Checking out branch {self.branch}")
self.repo.git.checkout(self.branch)

# cherry pick the commits based on the jira tickets
# cherry pick the commits based on the GH issue
for commit in self.commits_to_pick():
logger.info(f"Cherry-picking commit {commit.hexsha}")
self.repo.git.cherry_pick(commit.hexsha)
Expand Down
17 changes: 0 additions & 17 deletions dev/archery/archery/release/tests/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
Release, MajorRelease, MinorRelease, PatchRelease,
IssueTracker, Version, Issue, CommitTitle, Commit
)
from archery.testing import DotDict


# subset of issues per revision
Expand Down Expand Up @@ -141,22 +140,6 @@ def test_issue(fake_issue_tracker):
assert i.project == "PARQUET"
assert i.number == 1111

fake_jira_issue = DotDict({
'key': 'ARROW-2222',
'fields': {
'issuetype': {
'name': 'Feature'
},
'summary': 'Issue title'
}
})
i = Issue.from_jira(fake_jira_issue)
assert i.key == "ARROW-2222"
assert i.type == "Feature"
assert i.summary == "Issue title"
assert i.project == "ARROW"
assert i.number == 2222


def test_commit_title():
t = CommitTitle.parse(
Expand Down
4 changes: 0 additions & 4 deletions dev/archery/archery/templates/release_changelog.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
## {{ category }}

{% for issue, commit in issue_commit_pairs -%}
{% if issue.project in ('ARROW', 'PARQUET') -%}
* [{{ issue.key }}](https://issues.apache.org/jira/browse/{{ issue.key }}) - {{ commit.title.to_string(with_issue=False) if commit else issue.summary | md }}
{% else -%}
* [GH-{{ issue.key }}](https://github.com/apache/arrow/issues/{{ issue.key }}) - {{ commit.title.to_string(with_issue=False) if commit else issue.summary | md }}
{% endif -%}
{% endfor %}

{% endfor %}
13 changes: 0 additions & 13 deletions dev/archery/archery/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,6 @@
import re


class DotDict(dict):

def __getattr__(self, key):
try:
item = self[key]
except KeyError:
raise AttributeError(key)
if isinstance(item, dict):
return DotDict(item)
else:
return item


class PartialEnv(dict):

def __eq__(self, other):
Expand Down
4 changes: 2 additions & 2 deletions dev/archery/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
'lint': ['numpydoc==1.1.0', 'autopep8', 'flake8==6.1.0', 'cython-lint',
'cmake_format==0.6.13', 'sphinx-lint==0.9.1'],
'numpydoc': ['numpydoc==1.1.0'],
'release': ['pygithub', jinja_req, 'jira', 'semver', 'gitpython'],
'release': ['pygithub', jinja_req, 'semver', 'gitpython'],
}
extras['bot'] = extras['crossbow'] + ['pygithub', 'jira']
extras['bot'] = extras['crossbow'] + ['pygithub']
extras['all'] = list(set(functools.reduce(operator.add, extras.values())))

setup(
Expand Down

0 comments on commit 5293379

Please sign in to comment.