Skip to content

Commit

Permalink
Merge branch 'master' into feature/update_validation
Browse files Browse the repository at this point in the history
  • Loading branch information
HuangXiaoyan0106 authored Sep 16, 2024
2 parents 3b40f08 + 55d26dc commit 035772c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 3 additions & 1 deletion d3b_dff_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,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__ = '3.0.0'
__version__ = '3.0.0'

0 comments on commit 035772c

Please sign in to comment.