Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ add jira username and key as options to create ticket #16

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion d3b_dff_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ def create_parser():
create_ticket_parser.add_argument(
"-auth",
help="Base64 encoded Jira username and password",
required=True,
required=False,
)
create_ticket_parser.add_argument("-user", help="Jira username", required=False)
create_ticket_parser.add_argument("-key", help="Jira API key", required=False)
create_ticket_parser.add_argument(
"-jira_url",
help="Jira url",
Expand Down
15 changes: 14 additions & 1 deletion d3b_dff_cli/modules/jira/create_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
import time
from datetime import datetime
from base64 import b64encode

logger = logging.getLogger()
logger.setLevel(logging.INFO)
Expand Down Expand Up @@ -328,9 +329,21 @@ def get_transfer_key(epic_key, headers, jira_url):

def main(args):
"""Main function."""

# figure out if we have args.user and args.key or args.auth
auth = None

if args.user and args.key:
auth = b64encode(f"{args.user}:{args.key}".encode()).decode()
elif args.auth:
auth = args.auth
else:
logger.error("No authentication provided")
raise ValueError("No authentication provided")

headers = {
"Content-Type": "application/json",
"Authorization": f"Basic {args.auth}",
"Authorization": f"Basic {auth}",
}

# get issue type id from project
Expand Down
2 changes: 1 addition & 1 deletion d3b_dff_cli/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.0.1'
__version__ = '2.0.2'