Skip to content
Closed
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
20 changes: 20 additions & 0 deletions scripts/jira/manage_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,16 @@ def command_close(args):
)


def command_get_status(args):
"""Implement 'get_status' command."""
server = jira.JIRA(
server=SERVER_URL,
token_auth=os.environ.get("JIRA_API_TOKEN"),
)
ticket = server.issue(args.ticket_id)
print(f"{ticket.fields.status}")


def main():
"""The main program."""
parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -378,12 +388,22 @@ def main():
help='report but make no changes',
)

get_status_parser = subparsers.add_parser(
"get_status",
help="Find tickets status from ticket id",
)
get_status_parser.add_argument(
"--ticket-id", dest="ticket_id", default=None, help="the ticket id", type=str
)

args = parser.parse_args()

if args.command == 'start':
command_start(args)
elif args.command == 'close':
command_close(args)
elif args.command == "get_status":
command_get_status(args)
else:
parser.print_help()

Expand Down
17 changes: 17 additions & 0 deletions test/resources/common.resource
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ Documentation Keywords common to many test suites

Library OperatingSystem
Library String
Library Process
Library SSHLibrary
Resource ../resources/kubeconfig.resource


*** Variables ***
${JIRA_API_TOKEN} ${EMPTY}


*** Keywords ***
Setup Suite
[Documentation] Setup a namespace-less test suite by configuring Kubeconfig
Expand Down Expand Up @@ -113,3 +118,15 @@ Create Random Temp Directory
${path}= Join Path ${root_path} ${rand}
Create Directory ${path}
RETURN ${path}

Skip Test If Bug Is Open
[Documentation] Skip jira bug is not in Closed or Done state
[Arguments] ${ticket_id}

IF '${JIRA_API_TOKEN}' == '${EMPTY}'
Log Variable 'JIRA_API_TOKEN' does not exist. Test is NOT skipped
ELSE
${result}= Run Process ../scripts/jira/manage_ticket.sh get_status --ticket-id ${ticket_id} | tail -n1
... shell=True env:JIRA_API_TOKEN=${JIRA_API_TOKEN}
Skip If '${result.stdout}' == 'To Do' or '${result.stdout}' == 'In Progress' or '${result.stdout}' == 'Code Review' or '${result.stdout}' == 'Review'
END
2 changes: 2 additions & 0 deletions test/suites/standard1/networking-smoke.robot
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Router Smoke Test
... Expose Hello MicroShift Service Via Route
... Restart Router

Skip Test If Bug Is Open USHIFT-2349

Wait Until Keyword Succeeds 10x 6s
... Access Hello Microshift Success ${HTTP_PORT}

Expand Down