Created
May 24, 2019 19:01
-
-
Save kmonsoor/f4cc53a0c89e2b11843cb46748055cd6 to your computer and use it in GitHub Desktop.
Jira-Python : Create versions for project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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