Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Jira-Python : Create versions for project
# replce server address with actual Jira host for your case
options = {'server': 'https://jira.atlassian.com'}
#login
jira = JIRA(options, basic_auth=(os.environ['JIRA_USERNAME'], os.environ['JIRA_PASSWORD']))
#get currently available version names
project = jira.project('PROJECT-KEY')
versions = jira.project_versions(project)
current_versions = [v.name for v in reversed(versions)]
for number in range(0, 82):
vname = 'v' + str(number) + '.0.0'
# check in the existing version names
if vname in current_versions:
print(vname, ": exists")
else:
# try to create new
try:
version = jira.create_version(name=vname, project='PROJECT-KEY')
print(vname, ": created, all good")
except:
print(vname, ": creation failed")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment