in src/start_testbuilds.py [0:0]
def run_test_job(commit, codebuild_project, images_str=""):
test_env_file = constants.TEST_ENV_PATH
if not os.path.exists(test_env_file):
raise FileNotFoundError(
f"{test_env_file} not found. This is required to set test environment variables"
f" for test jobs. Failing the build."
)
with open(test_env_file) as test_env_file:
env_overrides = json.load(test_env_file)
pr_num = os.getenv("PR_NUMBER")
LOGGER.debug(f"pr_num {pr_num}")
env_overrides.extend(
[
{"name": "DLC_IMAGES", "value": images_str, "type": "PLAINTEXT"},
{"name": "PR_NUMBER", "value": pr_num, "type": "PLAINTEXT"},
# USE_SCHEDULER is passed as an env variable here because it is more convenient to set this in
# dlc_developer_config, compared to having another config file under dlc/tests/.
{
"name": "USE_SCHEDULER",
"value": str(config.is_scheduler_enabled()),
"type": "PLAINTEXT",
},
{
"name": "DISABLE_EFA_TESTS",
"value": str(not config.are_efa_tests_enabled()),
"type": "PLAINTEXT",
},
]
)
LOGGER.debug(f"env_overrides dict: {env_overrides}")
client = boto3.client("codebuild")
return client.start_build(
projectName=codebuild_project,
environmentVariablesOverride=env_overrides,
sourceVersion=commit,
)