示例#1
0
def post_status(state):
    """
    Post the status with a constructed context to the PR.

    :param state: <str> choices are "success", "failure", "error" or "pending"
    """
    # Executor does not send logs to GitHub when using the Scheduler
    if os.getenv("EXECUTOR_MODE", "False").lower() == "true":
        return

    project_name = utils.get_codebuild_project_name()
    trigger_job = os.getenv("TEST_TRIGGER", "UNKNOWN-TEST-TRIGGER")
    target_url = get_target_url(project_name)
    context = f"{trigger_job}_{project_name}"
    description = set_build_description(state, project_name, trigger_job)

    # Example: "https://github.com/aws/deep-learning-containers.git"
    repo_url = os.getenv("CODEBUILD_SOURCE_REPO_URL")
    _, user, repo_name = repo_url.rstrip(".git").rsplit("/", 2)

    handler = GitHubHandler(user, repo_name)
    handler.set_status(
        state=state,
        context=context,
        description=description,
        target_url=target_url
    )
def post_status(state):
    """
    Post the status with a constructed context to the PR.

    :param state: <str> choices are "success", "failure", "error" or "pending"
    """
    # Executor does not send logs to GitHub when using the Scheduler
    if os.getenv("EXECUTOR_MODE", "False").lower() == "true":
        return

    project_name = get_codebuild_project_name()
    target_url = get_target_url(project_name)

    test_context = os.getenv("TEST_TYPE")

    if test_context and test_context not in "quick_checks":
        trigger_job = os.getenv("TEST_TRIGGER", "UNKNOWN-TEST-TRIGGER")
        context = f"{trigger_job}_{project_name}"
    else:
        context = f"{project_name}"

    description = set_build_description(state, project_name)

    user, repo_name = get_user_and_repo_name()

    handler = GitHubHandler(user, repo_name)
    handler.set_status(
        state=state,
        context=context,
        description=description,
        target_url=target_url
    )
示例#3
0
def post_status(state):
    """
    Post the status with a constructed context to the PR.

    :param state: <str> choices are "success", "failure", "error" or "pending"
    """
    project_name = utils.get_codebuild_project_name()
    trigger_job = os.getenv("TEST_TRIGGER", "UNKNOWN-TEST-TRIGGER")
    target_url = get_target_url(project_name)
    context = f"{trigger_job}_{project_name}"
    description = set_build_description(state, project_name, trigger_job)

    handler = GitHubHandler()
    handler.set_status(
        state=state,
        context=context,
        description=description,
        target_url=target_url
    )