Skip to content

Unable to create a jira team report for mixed logins #419

Description

@psss

In the jira plugin self.user.login or self.user.email is used for constructing the search queries. For example:

did/did/plugins/jira.py

Lines 283 to 287 in 27bbcd5

query = (
f"creator = '{self.user.login or self.user.email}' "
f"AND created >= {self.options.since} "
f"AND created <= {self.options.until}"
)

In Jira both full email address and just name can be used as login. When defining aliases login and email are autodetected so it's not possible to explicitly specify full email address as a login.

did/did/base.py

Lines 469 to 490 in 98f6593

# Check for aliases specified in the email string
if aliases is not None:
try:
aliases = dict([
re.split(r"\s*:\s*", definition, maxsplit=1)
for definition in re.split(r"\s*;\s*", aliases.strip())])
except ValueError as exc:
raise ConfigError(f"Invalid alias definition: '{aliases}'") from exc
if stats in aliases:
if "@" in aliases[stats]:
email = aliases[stats]
else:
login = aliases[stats]
# Update login/email if alias detected
if email is not None:
self.email = email
log.info("Using email alias '%s' for '%s'", email, stats)
if login is None:
login = email.split("@")[0]
if login is not None:
self.login = login
log.info("Using login alias '%s' for '%s'", login, stats)

All this together means that it's not possible to create a jira team report if any of the users has email as their login.

Example config file:

[general]
width = 0
email =
    Petr Šplíchal <psplicha@redhat.com>; jira: psplicha@redhat.com,
    Miroslav Vadkerti <mvadkert@redhat.com>; jira: mvadkert

[jira]
type = jira
url = https://issues.redhat.com/
auth_type = token
token_file = ~/.did/jira-token

It would be probably good to allow explicitly define whether login or email is defined by the alias. Perhaps something like this?

email = Petr Šplíchal <psplicha@redhat.com>; jira:login: psplicha@redhat.com

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions