Add config.yaml, enhance Sub-Task generation (DoD)
This commit is contained in:
+47
-10
@@ -8,6 +8,7 @@ import re
|
|||||||
import csv
|
import csv
|
||||||
import xlsxwriter
|
import xlsxwriter
|
||||||
import logging
|
import logging
|
||||||
|
import yaml
|
||||||
from bisect import bisect_left
|
from bisect import bisect_left
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ def take_closest(myList, myNumber):
|
|||||||
|
|
||||||
def get_assignee(type, issue):
|
def get_assignee(type, issue):
|
||||||
# isBuergerfrontend = False
|
# isBuergerfrontend = False
|
||||||
if (type == 'Dev Backend' or type.startswith('Dev Unit')):
|
if (type == 'Dev Backend' or type.startswith('Dev Unit') or type == 'DoD SA/DEV'):
|
||||||
# use assignee of story
|
# use assignee of story
|
||||||
return 'rab9001'
|
return 'rab9001'
|
||||||
#return issue.fields.assignee.name
|
#return issue.fields.assignee.name
|
||||||
@@ -42,16 +43,21 @@ def get_assignee(type, issue):
|
|||||||
return 'thh9001'
|
return 'thh9001'
|
||||||
elif type == 'Dev Citizen-Frontend':
|
elif type == 'Dev Citizen-Frontend':
|
||||||
return 'reu9001'
|
return 'reu9001'
|
||||||
elif type.startswith('Test-Anpassung'):
|
elif type.startswith('Test-Anpassung') or type == 'DoD Test':
|
||||||
if issue.key.startswith('WRGWR-'):
|
if issue.key.startswith('WRGWR-'):
|
||||||
return 'ada9001'
|
return 'ada9001'
|
||||||
else:
|
else:
|
||||||
return 'osm9005'
|
return 'osm9005'
|
||||||
|
elif type == 'DoD PO':
|
||||||
|
return 'kom9010'
|
||||||
|
|
||||||
def create_subtask(issue, parent, type, subtask_sp, estimation_remark):
|
def create_subtask(issue, parent, type, subtask_sp=0, estimation_remark="", no_unit_test=False):
|
||||||
escaped = issue.fields.summary.replace('"', r'\"')
|
escaped = issue.fields.summary.replace('"', r'\"')
|
||||||
logging.info(f'summary ~ \"{escaped}\"')
|
logging.info(f'summary ~ \"{escaped}\"')
|
||||||
|
|
||||||
|
assignee = get_assignee(type, issue)
|
||||||
|
description = get_description(type)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
subtask = jira_server.search_issues(f'summary ~ \"{type} {escaped}\"')
|
subtask = jira_server.search_issues(f'summary ~ \"{type} {escaped}\"')
|
||||||
if subtask:
|
if subtask:
|
||||||
@@ -61,7 +67,7 @@ def create_subtask(issue, parent, type, subtask_sp, estimation_remark):
|
|||||||
#subtask.fields('timetracking': {'originalEstimate'}).Value() = subtask_sp
|
#subtask.fields('timetracking': {'originalEstimate'}).Value() = subtask_sp
|
||||||
single_issue = jira_server.issue(subtask[0].key)
|
single_issue = jira_server.issue(subtask[0].key)
|
||||||
try:
|
try:
|
||||||
single_issue.update(fields={'timetracking': {'originalEstimate': '{}d'.format(subtask_sp)}})
|
single_issue.update(fields={'timetracking': {'originalEstimate': '{}d'.format(subtask_sp)}, 'description': description, 'assignee': {'name': assignee}})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.info(e)
|
logging.info(e)
|
||||||
|
|
||||||
@@ -70,8 +76,6 @@ def create_subtask(issue, parent, type, subtask_sp, estimation_remark):
|
|||||||
|
|
||||||
issue_type = 'Sub-task'
|
issue_type = 'Sub-task'
|
||||||
|
|
||||||
assignee = get_assignee(type, issue)
|
|
||||||
description = 's. Story'
|
|
||||||
if estimation_remark != "":
|
if estimation_remark != "":
|
||||||
description += "\nEstimation remark: {}".format(estimation_remark)
|
description += "\nEstimation remark: {}".format(estimation_remark)
|
||||||
|
|
||||||
@@ -98,12 +102,26 @@ def create_subtask(issue, parent, type, subtask_sp, estimation_remark):
|
|||||||
|
|
||||||
logging.info('Created Sub-Task {}'.format(new_issue))
|
logging.info('Created Sub-Task {}'.format(new_issue))
|
||||||
|
|
||||||
|
def get_description(type):
|
||||||
|
if (type == 'DoD SA/DEV'):
|
||||||
|
description = cfg['subtask_desc_dev']
|
||||||
|
elif (type == 'DoD Test'):
|
||||||
|
description = cfg['subtask_desc_test']
|
||||||
|
elif (type == 'DoD PO'):
|
||||||
|
description = cfg['subtask_desc_po']
|
||||||
|
else:
|
||||||
|
description = 's. Story'
|
||||||
|
return description
|
||||||
|
|
||||||
logging.basicConfig(filename='sub_task_generator.log',
|
logging.basicConfig(filename='sub_task_generator.log',
|
||||||
filemode='a',
|
filemode='a',
|
||||||
format='%(asctime)s - %(levelname)s: %(message)s',
|
format='%(asctime)s - %(levelname)s: %(message)s',
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
encoding='utf-8')
|
encoding='utf-8')
|
||||||
|
|
||||||
|
with open("config.yaml", encoding='utf8') as f:
|
||||||
|
cfg = yaml.load(f, Loader=yaml.FullLoader)
|
||||||
|
|
||||||
host = "https://jira.wien.gv.at/"
|
host = "https://jira.wien.gv.at/"
|
||||||
pat = "OTAyMTM3MjY0MjE0Ovz6bu0ti1TlEdSegmmiWiJ2wGeD"
|
pat = "OTAyMTM3MjY0MjE0Ovz6bu0ti1TlEdSegmmiWiJ2wGeD"
|
||||||
sprint = 6
|
sprint = 6
|
||||||
@@ -127,6 +145,7 @@ for issue in issues_Jql:
|
|||||||
|
|
||||||
# only Issues with empty (or 0) story-points
|
# only Issues with empty (or 0) story-points
|
||||||
sp = 0
|
sp = 0
|
||||||
|
no_unit_test = False
|
||||||
if hasattr(issue.fields, 'customfield_10022'):
|
if hasattr(issue.fields, 'customfield_10022'):
|
||||||
sp = xsp(issue.fields.customfield_10022)
|
sp = xsp(issue.fields.customfield_10022)
|
||||||
|
|
||||||
@@ -170,11 +189,15 @@ for issue in issues_Jql:
|
|||||||
|
|
||||||
if comment_line_parts[0][:15] != "Test-Ausführung":
|
if comment_line_parts[0][:15] != "Test-Ausführung":
|
||||||
create_subtask(issue,
|
create_subtask(issue,
|
||||||
issue.key,
|
issue.key,
|
||||||
comment_line_parts[0],
|
comment_line_parts[0],
|
||||||
subtask_ph,
|
subtask_ph,
|
||||||
estimation_remark)
|
estimation_remark)
|
||||||
sp_sum += subtask_ph / 0.5
|
sp_sum += subtask_ph / 0.5
|
||||||
|
else:
|
||||||
|
logging.info(f'Sub-task creation skipped {comment_line_parts[0]} equals \'NN\'')
|
||||||
|
if "Unit-Test" in comment_line_parts[0]:
|
||||||
|
no_unit_test = True
|
||||||
|
|
||||||
# find corresponding sub-task
|
# find corresponding sub-task
|
||||||
# issuelinks.inwardIssue
|
# issuelinks.inwardIssue
|
||||||
@@ -189,6 +212,20 @@ for issue in issues_Jql:
|
|||||||
finally:
|
finally:
|
||||||
logging.info('Done {}'.format(issue.key))
|
logging.info('Done {}'.format(issue.key))
|
||||||
|
|
||||||
|
#create standard sub-tasks
|
||||||
|
for type in ['DoD SA/DEV','DoD Test','DoD PO']:
|
||||||
|
create_subtask(issue,
|
||||||
|
issue.key,
|
||||||
|
type,
|
||||||
|
no_unit_test=no_unit_test
|
||||||
|
)
|
||||||
|
|
||||||
|
#add or remove label #Unit-Test on story-level
|
||||||
|
if no_unit_test == False:
|
||||||
|
#issue.remove_field_value("labels", u'unit_test')
|
||||||
|
issue.add_field_value("labels", u'unit_test')
|
||||||
|
#issue.update(fields={"labels": issue.fields.labels})
|
||||||
|
|
||||||
#print('{}: {}, SP: {}'.format(issue.key, issue.fields.summary, sp))
|
#print('{}: {}, SP: {}'.format(issue.key, issue.fields.summary, sp))
|
||||||
|
|
||||||
#print('Summe {}: {}'.format(assignee, sp_sum))
|
#print('Summe {}: {}'.format(assignee, sp_sum))
|
||||||
|
|||||||
+4
-12
@@ -1,13 +1,5 @@
|
|||||||
{'maintainer': 'Markus Zimmerberger',
|
{'maintainer': 'Markus Zimmerberger',
|
||||||
'pca_params': {'n_components': 224},
|
'subtask_desc_dev': "||Definition of Done||Verantwortung||\r\n|Code eingechecked und steht unter Versionsverwaltung|DEV|\r\n|Der Code ist vollständig implementiert und kommentiert|DEV|\r\n|Deployment Scripts fertig (wo notwendig, Story mit Label versehen)|DEV|\r\n|Code reviewed|SA/DEV|\r\n|Die Coding Standards _(Confluence Link einfügen)_ und die internen Konventionen _(Verweis)_ wurden eingehalten. (optional)|SA/DEV|\r\n|Alle Akzeptanzkriterien werden erfüllt|DEV|\r\n|Die Unit-Tests wurden durchgeführt und bestanden (wo notwendig, Story mit Label versehen)|DEV|\r\n|Dokumentationen sind aktualisiert|SA/DEV|",
|
||||||
'umap_params': {'metrics': ['euclidean', 'l1', 'manhattan'],
|
'subtask_desc_test': "||Definition of Done||Verantwortung||\r\n|Tests laut Testkonzept abgeschlossen|TE|\r\n|Deployed auf Testumgebungen|TE|\r\n|Dokumentationen sind aktualisiert|TE|\r\n|Im Review akzeptiert (bei Bugs und defects)|TE|",
|
||||||
'min_dist': [0.01, 0.1, 0.5],
|
'subtask_desc_po': "||Definition of Done||Verantwortung||\r\n|Im Review akzeptiert|PO|"
|
||||||
'spread': 1.0},
|
}
|
||||||
'visualize_params': {'median_threshold': 6},
|
|
||||||
'spreadsheet_name': 'Zeiterfassung alle Projekte',
|
|
||||||
'worksheet_name': 'September 2024',
|
|
||||||
'week': [37],
|
|
||||||
'name': 'Markus Zimmerberger',
|
|
||||||
'username': 'ZIM9003',
|
|
||||||
'ansprechpartner_username': 'GRM0003',
|
|
||||||
'ansprechpartner_name': 'Marlene Griesser'}
|
|
||||||
Reference in New Issue
Block a user