Ejemplo n.º 1
0
def main():
    parameters = parse_parameters()
    review_request_url = "%s/api/review-requests/%s/" % (REVIEWBOARD_URL,
                                                         parameters.review_id)
    handler = ReviewBoardHandler()
    review_request = handler.api(review_request_url)["review_request"]
    review_ids = handler.get_review_ids(review_request)
    with open(parameters.out_file, 'w') as f:
        for r_id in review_ids:
            f.write("%s\n" % (str(r_id)))
Ejemplo n.º 2
0
def main():
    """Main function to verify the submitted reviews."""
    parameters = parse_parameters()
    print "\n%s - Running %s" % (time.strftime('%m-%d-%y_%T'),
                                 os.path.abspath(__file__))
    review_requests_url = "%s/api/review-requests/%s" % (REVIEWBOARD_URL,
                                                         parameters.query)
    handler = ReviewBoardHandler(parameters.user, parameters.password)
    num_reviews = 0
    review_ids = []
    review_requests = handler.api(review_requests_url)
    for review_request in reversed(review_requests["review_requests"]):
        if ((parameters.reviews == -1 or num_reviews < parameters.reviews) and
           handler.needs_verification(review_request)):
            try:
                # If there are no reviewers specified throw an error.
                if not review_request["target_people"]:
                    raise ReviewError("No reviewers specified. Please find "
                                      "a reviewer by asking on JIRA or the "
                                      "mailing list.")
                # An exception is raised if cyclic dependencies are found
                handler.get_review_ids(review_request)
            except ReviewError as err:
                message = ("Bad review!\n\n"
                           "Error:\n%s" % (err.args[0]))
                handler.post_review(review_request, message)
                continue
            review_ids.append(str(review_request["id"]))
            num_reviews += 1
    verify_reviews(review_ids, parameters)
def main():
    """Main function to verify the submitted reviews."""
    parameters = parse_parameters()
    print "\n%s - Running %s" % (time.strftime('%m-%d-%y_%T'),
                                 os.path.abspath(__file__))
    review_requests_url = "%s/api/review-requests/%s" % (REVIEWBOARD_URL,
                                                         parameters.query)
    handler = ReviewBoardHandler(parameters.user, parameters.password)
    num_reviews = 0
    review_ids = []
    review_requests = handler.api(review_requests_url)
    for review_request in reversed(review_requests["review_requests"]):
        if (parameters.reviews == -1 or num_reviews < parameters.reviews):
            try:
                needs_verification = handler.needs_verification(review_request)
                if not needs_verification:
                    continue
                # An exception is raised if cyclic dependencies are found
                handler.get_review_ids(review_request)
            except ReviewError as err:
                message = ("Bad review!\n\n" "Error:\n%s" % (err.args[0]))
                handler.post_review(review_request, message)
                continue
            except Exception:
                needs_verification = False
                print(
                    "WARNING: Cannot find if review %s needs "
                    "verification" % (review_request["id"]))
            if not needs_verification:
                continue
            review_ids.append(str(review_request["id"]))
            num_reviews += 1
    verify_reviews(review_ids, parameters)
def main():
    parameters = parse_parameters()
    review_request_url = "%s/api/review-requests/%s/" % (REVIEWBOARD_URL,
                                                         parameters.review_id)
    handler = ReviewBoardHandler(parameters.user, parameters.password)
    review_request = handler.api(review_request_url)["review_request"]
    logs_urls = []
    if parameters.logs_urls:
        logs_urls = parameters.logs_urls.split('|')
    applied_reviews = []
    if parameters.applied_reviews:
        applied_reviews = parameters.applied_reviews.split('|')
    message = get_build_message(message=parameters.message,
                                logs_urls=logs_urls,
                                applied_reviews=applied_reviews,
                                outputs_url=parameters.outputs_url,
                                failed_command=parameters.failed_command)
    handler.post_review(review_request, message)
Ejemplo n.º 5
0
def main():
    """
    Main method to get dependent review IDs of a specific review request
    on the ReviewBoard.
    """
    parameters = parse_parameters()
    review_request_url = "%s/api/review-requests/%s/" % (REVIEWBOARD_URL,
                                                         parameters.review_id)
    handler = ReviewBoardHandler()
    review_request = handler.api(review_request_url)["review_request"]
    review_ids = handler.get_dependent_review_ids(review_request)
    if parameters.out_file:
        with open(parameters.out_file, 'w') as f:
            for r_id in review_ids:
                f.write("%s\n" % (str(r_id)))
    else:
        for r_id in review_ids:
            print("%s\n" % (str(r_id)))
Ejemplo n.º 6
0
def main():
    """
    Main method to get dependent review IDs of a specific review request
    on the ReviewBoard.
    """
    parameters = parse_parameters()
    review_request_url = "%s/api/review-requests/%s/" % (REVIEWBOARD_URL,
                                                         parameters.review_id)
    handler = ReviewBoardHandler()
    review_request = handler.api(review_request_url)["review_request"]
    review_ids = handler.get_dependent_review_ids(review_request)
    if parameters.out_file:
        with open(parameters.out_file, 'w') as f:
            for r_id in review_ids:
                f.write("%s\n" % (str(r_id)))
    else:
        for r_id in review_ids:
            print("%s\n" % (str(r_id)))
Ejemplo n.º 7
0
def main():
    """Posts build result to the ReviewBoard"""
    parameters = parse_parameters()
    review_request_url = "%s/api/review-requests/%s/" % (REVIEWBOARD_URL,
                                                         parameters.review_id)
    handler = ReviewBoardHandler(parameters.user, parameters.password)
    review_request = handler.api(review_request_url)["review_request"]
    logs_urls = []
    if parameters.logs_urls:
        logs_urls = parameters.logs_urls.split('|')
    applied_reviews = []
    if parameters.applied_reviews:
        applied_reviews = parameters.applied_reviews.split('|')
    message = get_build_message(message=parameters.message,
                                logs_urls=logs_urls,
                                applied_reviews=applied_reviews,
                                outputs_url=parameters.outputs_url,
                                failed_command=parameters.failed_command)
    handler.post_review(review_request, message)
Ejemplo n.º 8
0
def main():
    """Main function to verify the submitted reviews."""
    parameters = parse_parameters()
    print("\n%s - Running %s" % (time.strftime('%m-%d-%y_%T'),
                                 os.path.abspath(__file__)))
    # The colon from timestamp gets encoded and we don't want it to be encoded.
    # Replacing %3A with colon.
    query_string = urllib.parse.urlencode(
        json.loads(parameters.query)).replace("%3A", ":")
    review_requests_url = "%s/api/review-requests/?%s" % (REVIEWBOARD_URL,
                                                          query_string)
    handler = ReviewBoardHandler(parameters.user, parameters.password)
    num_reviews = 0
    review_ids = []
    review_requests = handler.api(review_requests_url)
    for review_request in reversed(review_requests["review_requests"]):
        if parameters.reviews == -1 or num_reviews < parameters.reviews:
            try:
                needs_verification = handler.needs_verification(review_request)
                if not needs_verification:
                    continue
                # An exception is raised if cyclic dependencies are found
                handler.get_dependent_review_ids(review_request)
            except ReviewError as err:
                message = ("Bad review!\n\n"
                           "Error:\n%s" % (err.args[0]))
                handler.post_review(review_request, message, handler)
                continue
            except Exception as err:
                print("Error occured: %s" % err)
                needs_verification = False
                print("WARNING: Cannot find if review %s needs"
                      " verification" % (review_request["id"]))
            if not needs_verification:
                continue
            review_ids.append(str(review_request["id"]))
            num_reviews += 1
            if not parameters.skip_verify:
                verify_review(review_request, handler)

    verification_needed_write(review_ids, parameters)
Ejemplo n.º 9
0
def main():
    """Main function to verify the submitted reviews."""
    parameters = parse_parameters()
    print("\n%s - Running %s" % (time.strftime('%m-%d-%y_%T'),
                                 os.path.abspath(__file__)))
    # The colon from timestamp gets encoded and we don't want it to be encoded.
    # Replacing %3A with colon.
    query_string = urllib.parse.urlencode(
        json.loads(parameters.query)).replace("%3A", ":")
    review_requests_url = "%s/api/review-requests/?%s" % (REVIEWBOARD_URL,
                                                          query_string)
    handler = ReviewBoardHandler(parameters.user, parameters.password)
    num_reviews = 0
    review_ids = []
    review_requests = handler.api(review_requests_url)
    for review_request in reversed(review_requests["review_requests"]):
        if parameters.reviews == -1 or num_reviews < parameters.reviews:
            try:
                needs_verification = handler.needs_verification(review_request)
                if not needs_verification:
                    continue
                # An exception is raised if cyclic dependencies are found
                handler.get_dependent_review_ids(review_request)
            except ReviewError as err:
                message = ("Bad review!\n\n"
                           "Error:\n%s" % (err.args[0]))
                handler.post_review(review_request, message, handler)
                continue
            except Exception as err:
                print("Error occured: %s" % err)
                needs_verification = False
                print("WARNING: Cannot find if review %s needs"
                      " verification" % (review_request["id"]))
            if not needs_verification:
                continue
            review_ids.append(str(review_request["id"]))
            num_reviews += 1
            if not parameters.skip_verify:
                verify_review(review_request, handler)

    verification_needed_write(review_ids, parameters)