Add initial jira integration that gets summary data
We pull the credentials from a config file and use them to get information out of jira about created tickets, completed tickets and tickets without an epic
This commit is contained in:
parent
3151881de3
commit
197659c020
3 changed files with 109 additions and 0 deletions
46
bin/jira-summary
Executable file
46
bin/jira-summary
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env python
|
||||
import datetime
|
||||
import logging
|
||||
import pprint
|
||||
import requests
|
||||
import teamanalysis.config
|
||||
import teamanalysis.jira
|
||||
import teamanalysis.time
|
||||
|
||||
LOGGER = logging.getLogger('jira-summary')
|
||||
|
||||
def _get_without_epic(created):
|
||||
without_epic = [issue for issue in created['issues'] if issue['fields']['customfield_10008'] is None]
|
||||
return without_epic
|
||||
|
||||
def _show_summary(session, timepoint):
|
||||
start, end = teamanalysis.time.get_checkpoint(timepoint)
|
||||
created = teamanalysis.jira.issues_created_between(session, start, end)
|
||||
without_epic = _get_without_epic(created)
|
||||
resolved = teamanalysis.jira.issues_resolved_between(session, start, end)
|
||||
print("\t".join([
|
||||
start.date().isoformat(),
|
||||
end.date().isoformat(),
|
||||
str(created['total']),
|
||||
str(resolved['total']),
|
||||
str(len(without_epic)),
|
||||
]))
|
||||
|
||||
def main():
|
||||
logging.basicConfig()
|
||||
logging.getLogger().setLevel(logging.DEBUG)
|
||||
logging.getLogger('requests').setLevel(logging.INFO)
|
||||
|
||||
config = teamanalysis.config.get()
|
||||
|
||||
timepoint = datetime.datetime(2015, 5, 1, 0, 0, 1)
|
||||
session = teamanalysis.jira.create_session(**config['jira'])
|
||||
|
||||
now = datetime.datetime.utcnow()
|
||||
while timepoint < now + datetime.timedelta(days=7):
|
||||
_show_summary(session, timepoint)
|
||||
timepoint = timepoint + datetime.timedelta(days=7)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Add table
Add a link
Reference in a new issue