I've below code to read fix version name:
from jira import JIRA
jira_options = {'server': 'URL'}
jira = JIRA(basic_auth=('username', 'pwd'), options = {'server': 'username'})
fix_version = getparsedstring(issue.fields.fixVersions) #since fix Versions is not readable version name, using getparsedstring custom function to get readable string
Objective is to get release date of the version from issue, as I will be reading all issues of project through iterations.
As per answer given in this question, below would retrieve release date:
i = jira.version(v.id, expand="ReleaseDate")
i.releaseDate
How do I get release date using issue details through JIRA library?
Note: I do not want to read it through REST API
Thanks in advance!
issue = jira.issue('PRJ-1234')
# iterate through all fixVersions of the current issue
for fixVersion in issue.fields.fixVersions:
# print fixVersion Name and respective Release Date
print(f'{fixVersion.name} has the release date: {fixVersion.releaseDate}')
Another option is to create a release map:
# create dictionary with release name as key and release date as value
def createReleaseVersionMap(jira, project):
versions = jira.project_versions(project)
# Make a map from version name -> version release date
for version in versions:
try:
prjVersionList[version.name] = version.releaseDate
# if no release date is set for this version,
# do something else, e.g., use the name as value instead of the date
except AttributeError:
prjVersionList[version.name] = version.name
return prjVersionList
And then just use the dictionary in your code to retrieve the respective release dates:
my_release_map = createReleaseVersionMap(jira, 'PRJ')
release_date_I_need = my_release_map['Release Name']