Skip to content

Commit

Permalink
jira: Count verified issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszachy committed Jan 4, 2024
1 parent e91b752 commit 92c5e82
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions did/plugins/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
Name of the token to check for expiration in ``token_expiration``
days. This has to match the name as seen in your Jira profile.
verified_status
Name of the issue status which marks it verified.
Defaults to ``Release Pending``.
Configuration example (GSS authentication)::
[issues]
Expand Down Expand Up @@ -104,6 +108,8 @@
# Enable ssl verify
SSL_VERIFY = True

# State marking verified issues
DEFAULT_VERIFIED_STATUS = "Release Pending"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Issue Investigator
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -261,10 +267,30 @@ def fetch(self):
self.stats = Issue.search(query, stats=self)


class JiraVerified(Stats):
""" Verified issues """

def fetch(self):
log.info("Searching for issues transitioned to {0} by {1}".format(
self.parent.verified_status, self.user.login or self.user.email
))
query = (
"status changed to '{0}' and status changed by {1} "
"after {2} before {3}".format(
self.parent.verified_status,
self.user.login or self.user.email,
self.options.since,
self.options.until))
if self.parent.project:
query = query + " AND project = '{0}'".format(
self.parent.project)
self.stats = Issue.search(query, stats=self)

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Stats Group
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


class JiraStats(StatsGroup):
""" Jira stats """

Expand Down Expand Up @@ -369,6 +395,10 @@ def __init__(self, option, name=None, parent=None, user=None):

# Check for custom prefix
self.prefix = config["prefix"] if "prefix" in config else None

# State marking Verified jira
self.verified_status = config.get("verified_status", DEFAULT_VERIFIED_STATUS)

# Create the list of stats
self.stats = [
JiraCreated(
Expand All @@ -380,6 +410,9 @@ def __init__(self, option, name=None, parent=None, user=None):
JiraResolved(
option=option + "-resolved", parent=self,
name="Issues resolved in {0}".format(option)),
JiraVerified(
option=option + "-verified", parent=self,
name="Issues verified in {0}".format(option)),
]

@property
Expand Down

0 comments on commit 92c5e82

Please sign in to comment.