Exemplo n.º 1
0
    dest="taskdescriptionfull",
    help="Task Description, eg., \"Please perform the following tasks...\"")
# see createTaskJIRAs.py.examples.txt for examples of taskdescriptionfull

(options, args) = parser.parse_args()

if not options.usernameJIRA or not options.passwordJIRA or not options.jiraserver or not options.frombranch or not options.jbidefixversion or not options.jbdsfixversion or not options.taskdescription:
    parser.error("Must to specify ALL commandline flags")

jiraserver = options.jiraserver
jbide_fixversion = options.jbidefixversion
jbds_fixversion = options.jbdsfixversion

from components import checkFixVersionsExist, queryComponentLead, defaultAssignee

if checkFixVersionsExist(jbide_fixversion, jbds_fixversion, jiraserver,
                         options.usernameJIRA, options.passwordJIRA) == True:

    frombranch = options.frombranch
    jira = JIRA(options={'server': jiraserver},
                basic_auth=(options.usernameJIRA, options.passwordJIRA))
    CLJBIDE = jira.project_components(
        jira.project('JBIDE'))  # full list of components in JBIDE
    CLJBDS = jira.project_components(
        jira.project('JBDS'))  # full list of components in JBIDE

    taskdescription = options.taskdescription
    taskdescriptionfull = options.taskdescriptionfull
    if not options.taskdescriptionfull:
        taskdescriptionfull = options.taskdescription

    ## The jql query across for all task issues
parser.add_option("-v", "--testpwd", dest="passwordTestServer", help="Test Server Password, eg., kerberos pwd")

(options, args) = parser.parse_args()

if not options.jbideversion or not options.component or \
	not options.jiraserver or not options.usernameJIRA or not options.passwordJIRA or \
	not options.testurl or not options.usernameTestServer or not options.passwordTestServer:
	parser.error("Must to specify ALL commandline flags")
	
jiraserver = options.jiraserver

jbide_affectedversion = options.jbideversion

from components import checkFixVersionsExist, queryComponentLead

if checkFixVersionsExist(jbide_affectedversion, None, jiraserver, options.usernameJIRA, options.passwordJIRA) == True:

	component = options.component
	testurl = options.testurl

	## The jql query across for all testfailure issues
	testfailuresearchquery = 'labels IN ("testfailure") AND project IN (JBIDE) AND affectedVersion IN ("' + jbide_affectedversion + '") AND component IN ("' + component + '")'
	testfailuresearch = jiraserver + '/issues/?jql=' + urllib.quote_plus(testfailuresearchquery)
	testfailuresearchlabel = 'Search for Test Failure JIRAs in JBIDE ' + jbide_affectedversion + ' for ' + component + ' component'

	# result here is pretty-printed XML
	def prettyXML(xml):
		uglyXml = xml.toprettyxml(indent='  ')
		text_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL)	
		out = text_re.sub('>\g<1></', uglyXml)
		return out
Exemplo n.º 3
0
            options.jirauser, theissue, componentLead,
            sys.exc_info()[0])


def setTaskLabel(theissue):
    try:
        issue = jira.issue(theissue.key)
        issue.fields.labels.append(u'task')
        issue.update(fields={"labels": issue.fields.labels})
    except:
        print "[WARNING] Unexpected error! User {0} tried to set label = 'task' on {1}: {2}".format(
            options.jirauser, theissue,
            sys.exc_info()[0])


if checkFixVersionsExist(jbide_fixversion, jbds_fixversion, jiraserver,
                         options.jirauser, options.jirapwd) == True:
    ## The jql query across for all N&N - to find issues for which N&N needs to be written
    nnsearchquery = '((project in (JBDS) and fixVersion = "' + \
     jbds_fixversion + '") or (project in (FUSETOOLS) and fixVersion = "' + \
     fuse_fixversion + '") or (project in (JBIDE) and fixVersion = "' + \
     jbide_fixversion + '")) AND resolution = Done AND labels = new_and_noteworthy'
    nnsearch = jiraserver + '/issues/?jql=' + urllib.quote_plus(nnsearchquery)

    # queries to find other created N&N Task issues, not issues for which N&N should be written
    nnissuesqueryall = 'summary ~ "New and Noteworthy" AND project in (JBDS, FUSETOOLS, JBIDE) ORDER BY key DESC'
    nnissuesquerythisversion = 'summary ~ "New and Noteworthy" AND ((project in (JBDS) and fixVersion = "' + \
     jbds_fixversion + '") or (project in (FUSETOOLS) and fixVersion = "' + \
     fuse_fixversion + '") or (project in (JBIDE) and fixVersion = "' + \
     jbide_fixversion + '")) ORDER BY key DESC'

    rootnn_description = 'This [query|' + nnsearch + '] contains the search for all N&N. See subtasks below.'
Exemplo n.º 4
0
                  help="Test Server Password, eg., kerberos pwd")

(options, args) = parser.parse_args()

if not options.jbideversion or not options.component or \
 not options.jiraserver or not options.usernameJIRA or not options.passwordJIRA or \
 not options.testurl or not options.usernameTestServer or not options.passwordTestServer:
    parser.error("Must to specify ALL commandline flags")

jiraserver = options.jiraserver

jbide_affectedversion = options.jbideversion

from components import checkFixVersionsExist, queryComponentLead

if checkFixVersionsExist(jbide_affectedversion, None, jiraserver,
                         options.usernameJIRA, options.passwordJIRA) == True:

    component = options.component
    testurl = options.testurl

    ## The jql query across for all testfailure issues
    testfailuresearchquery = 'labels IN ("testfailure") AND project IN (JBIDE) AND affectedVersion IN ("' + jbide_affectedversion + '") AND component IN ("' + component + '")'
    testfailuresearch = jiraserver + '/issues/?jql=' + urllib.quote_plus(
        testfailuresearchquery)
    testfailuresearchlabel = 'Search for Test Failure JIRAs in JBIDE ' + jbide_affectedversion + ' for ' + component + ' component'

    # result here is pretty-printed XML
    def prettyXML(xml):
        uglyXml = xml.toprettyxml(indent='  ')
        text_re = re.compile('>\n\s+([^<>\s].*?)\n\s+</', re.DOTALL)
        out = text_re.sub('>\g<1></', uglyXml)
Exemplo n.º 5
0
sprint = options.sprint
sprint_NEXT = options.sprint_NEXT
sprintId = None # not used other than to verify the sprint exists
sprintId_NEXT = None # used to set a new sprint value

# define list of labels to skip
skipLabels = options.skipLabels.split(",") if options.skipLabels else ""

def missingFixversion(version_jbt, version_ds):
	sys.exit("[ERROR] FixVersion does not exist. Go bug " + components.defaultAssignee() + " to get it created.")

sprintId = components.getSprintId(sprint, jiraserver, jirauser, jirapwd)
sprintId_NEXT = components.getSprintId(sprint_NEXT, jiraserver, jirauser, jirapwd)
if not options.skipVersionValidation:
	if components.checkFixVersionsExist(version_jbt, version_ds, jiraserver, jirauser, jirapwd) == False:
		missingFixversion(version_jbt, version_ds)
	if components.checkFixVersionsExist(version_jbt_NEXT, version_ds_NEXT, jiraserver, jirauser, jirapwd) == False:
		missingFixversion(version_jbt_NEXT, version_ds_NEXT)
	if components.checkFixVersionsExist(version_jbt_DOTX, version_ds_DOTX, jiraserver, jirauser, jirapwd) == False:
		missingFixversion(version_jbt_DOTX, version_ds_DOTX)

###################################################

def updateIssues(issuelist, NEXTorDOTX, description):
	numExistingIssues = len(issuelist) if not issuelist == None else 0
	if numExistingIssues > 0 : 
		if debug: print "[DEBUG] Move " + str(numExistingIssues) + " " + description
		jira = JIRA(options={'server':jiraserver}, basic_auth=(jirauser, jirapwd))

		cnt = 0
try:
	jira = JIRA(options={'server':jiraserver}, basic_auth=(options.usernameJIRA, options.passwordJIRA))
except AttributeError as e:
	sys.exit("[ERROR] Could not connect to {0} as {1} with passwordJIRA {2}".format(jiraserver, options.usernameJIRA, options.passwordJIRA))
except:
	sys.exit("[ERROR] Unexpected error:", sys.exc_info()[0])

CLJBIDE = jira.project_components(jira.project('JBIDE')) # full list of components in JBIDE
CLJBDS = jira.project_components(jira.project('JBDS')) # full list of components in JBIDE

jbide_fixversion = options.jbidefixversion
jbds_fixversion = options.jbdsfixversion

from components import checkFixVersionsExist, queryComponentLead

if checkFixVersionsExist(jbide_fixversion, jbds_fixversion, jiraserver, options.usernameJIRA, options.passwordJIRA) == True:

	taskdescription = options.taskdescription
	taskdescriptionfull = options.taskdescriptionfull.replace("\\n", "\n")
	if not options.taskdescriptionfull:
		taskdescriptionfull = options.taskdescription

	projectname = 'JBIDE'
	fixversion = jbide_fixversion
	if not options.componentjbide and not options.componentjbds:
		# see JIRA_components listing in components.py
		from components import JIRA_components
		componentList = JIRA_components
		issuetype = 'Sub-task'
	else:
		# just one task at a time
	try:
		jira.assign_issue(theissue, componentLead)
	except:
		print "[WARNING] Unexpected error! User {0} tried to assign {1} to {2}: {3}".format(options.jirauser, theissue, componentLead, sys.exc_info()[0])


def setTaskLabel(theissue):
	try:
		issue = jira.issue(theissue.key)
		issue.fields.labels.append(u'task')
		issue.update(fields={"labels": issue.fields.labels})
	except:
		print "[WARNING] Unexpected error! User {0} tried to set label = 'task' on {1}: {2}".format(options.jirauser, theissue, sys.exc_info()[0])


if checkFixVersionsExist(jbide_fixversion, jbds_fixversion, jiraserver, options.jirauser, options.jirapwd) == True:
	## The jql query across for all N&N - to find issues for which N&N needs to be written
	nnsearchquery = '((project in (JBDS) and fixVersion = "' + \
		jbds_fixversion + '") or (project in (FUSETOOLS) and fixVersion = "' + \
		fuse_fixversion + '") or (project in (JBIDE) and fixVersion = "' + \
		jbide_fixversion + '")) AND resolution = Done AND labels = new_and_noteworthy'
	nnsearch = jiraserver + '/issues/?jql=' + urllib.quote_plus(nnsearchquery)

	# queries to find other created N&N Task issues, not issues for which N&N should be written
	nnissuesqueryall = 'summary ~ "New and Noteworthy" AND project in (JBDS, FUSETOOLS, JBIDE) ORDER BY key DESC'
	nnissuesquerythisversion = 'summary ~ "New and Noteworthy" AND ((project in (JBDS) and fixVersion = "' + \
		jbds_fixversion + '") or (project in (FUSETOOLS) and fixVersion = "' + \
		fuse_fixversion + '") or (project in (JBIDE) and fixVersion = "' + \
		jbide_fixversion + '")) ORDER BY key DESC'

	rootnn_description = 'This [query|' + nnsearch + '] contains the search for all N&N. See subtasks below.'
sprint = options.sprint
sprint_NEXT = options.sprint_NEXT
sprintId = None # not used other than to verify the sprint exists
sprintId_NEXT = None # used to set a new sprint value

# define list of labels to skip
skipLabels = options.skipLabels.split(",") if options.skipLabels else ""

def missingFixversion(version_jbt, version_ds):
	sys.exit("[ERROR] FixVersion does not exist. Go bug " + components.defaultAssignee() + " to get it created.")

sprintId = components.getSprintId(sprint, jiraserver, jirauser, jirapwd)
sprintId_NEXT = components.getSprintId(sprint_NEXT, jiraserver, jirauser, jirapwd)
if not options.skipVersionValidation:
	if components.checkFixVersionsExist(version_jbt, version_ds, jiraserver, jirauser, jirapwd) == False:
		missingFixversion(version_jbt, version_ds)
	if components.checkFixVersionsExist(version_jbt_NEXT, version_ds_NEXT, jiraserver, jirauser, jirapwd) == False:
		missingFixversion(version_jbt_NEXT, version_ds_NEXT)
	if components.checkFixVersionsExist(version_jbt_DOTX, version_ds_DOTX, jiraserver, jirauser, jirapwd) == False:
		missingFixversion(version_jbt_DOTX, version_ds_DOTX)

###################################################

def updateIssues(issuelist, NEXTorDOTX, description):
	numExistingIssues = len(issuelist) if not issuelist == None else 0
	if numExistingIssues > 0 : 
		if debug: print "[DEBUG] Move " + str(numExistingIssues) + " " + description
		jira = JIRA(options={'server':jiraserver}, basic_auth=(jirauser, jirapwd))

		cnt = 0