예제 #1
0
def add_jira_comment_with_table(
    jira_id, data_headers, data_array, msg_prefix="", **format_kwargs
):
    """
    Add a comment to a JIRA with a formatted data table.

    Args:
        jira_id (str): the Issue ID of the JIRA to be updated
        data_headers (list of str): a list of header column names
        data_array (list of list of str,int): An array of lists of strings,
            representing table rows. e.g.::

            [["a", "b", "c"], ["d", "e", "f"]]

        **format_kwargs: formatting keyword args
            to be passed to jiratools.formatting.format_jira_msg

    Returns:
        str: the Issue ID of the JIRA which received the comment
    """
    message_with_table = "{}{}".format(
        msg_prefix, format_as_jira_table(data_headers, data_array)
    )
    add_comment(
        jira_id, format_autoupdate_jira_msg(message_with_table, **format_kwargs)
    )
    return jira_id
예제 #2
0
def add_jira_error_comment(jira_id, error_msg, **format_kwargs):
    """
    Add a comment to a JIRA with a formatted error message.

    Args:
        jira_id (str): the Issue ID of the JIRA to be updated
        error_msg (str): the raw error message to include in the comment
        **format_kwargs: formatting keyword args
            to be passed to jiratools.formatting.format_jira_msg

    Returns:
        str: the Issue ID of the JIRA which received the comment
    """
    add_comment(
        jira_id,
        format_autoupdate_jira_msg(format_as_code_block(error_msg), **format_kwargs),
    )
    return jira_id