in src/start_testbuilds.py [0:0]
def main():
build_context = os.getenv("BUILD_CONTEXT")
if build_context != "PR":
LOGGER.info(f"Not triggering test jobs from boto3, as BUILD_CONTEXT is {build_context}")
return
# load the images for all test_types to pass on to code build jobs
with open(constants.TEST_TYPE_IMAGES_PATH) as json_file:
test_images = json.load(json_file)
# Run necessary PR test jobs
commit = os.getenv("CODEBUILD_RESOLVED_SOURCE_VERSION")
for test_type, images in test_images.items():
# only run the code build test jobs when the images are present
LOGGER.debug(f"test_type : {test_type}")
LOGGER.debug(f"images: {images}")
if images:
pr_test_job = f"dlc-pr-{test_type}-test"
images_str = " ".join(images)
# Maintaining separate codebuild project for graviton sanity test
if "graviton" in images_str and test_type == "sanity":
pr_test_job += "-graviton"
if is_test_job_enabled(test_type):
LOGGER.debug(f"Test job enabled for {test_type} test")
if "huggingface" in images_str and test_type in [
constants.EC2_TESTS,
constants.ECS_TESTS,
constants.EKS_TESTS,
]:
LOGGER.debug(f"Skipping huggingface {test_type} test")
continue
run_test_job(commit, pr_test_job, images_str)
# Trigger sagemaker local test jobs when there are changes in sagemaker_tests
# sagemaker local test is not supported in benchmark dev mode
if (
test_type == "sagemaker"
and not config.is_benchmark_mode_enabled()
and config.is_sm_local_test_enabled()
):
test_job = f"dlc-pr-{test_type}-local-test"
run_test_job(commit, test_job, images_str)