Skip to content

Commit fba0267

Browse files
author
Dan Xie
committed
feat: add default_codebuild_image
1 parent 51f6936 commit fba0267

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_constructs/adf_codebuild.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
ADF_DEPLOYMENT_REGION = os.environ["AWS_REGION"]
2424
ADF_DEPLOYMENT_ACCOUNT_ID = os.environ["ACCOUNT_ID"]
25+
DEFAULT_CODEBUILD_IMAGE = "STANDARD_5_0"
2526
DEFAULT_BUILD_SPEC_FILENAME = 'buildspec.yml'
2627
DEFAULT_DEPLOY_SPEC_FILENAME = 'deployspec.yml'
2728
ADF_DEFAULT_BUILD_ROLE_NAME = 'adf-codebuild-role'
@@ -338,7 +339,7 @@ def determine_build_spec(codebuild_id, default_props, target=None):
338339

339340
@staticmethod
340341
def get_image_by_name(specific_image: str):
341-
cdk_image_name = specific_image.upper()
342+
cdk_image_name = (specific_image or DEFAULT_CODEBUILD_IMAGE).upper()
342343
if hasattr(_codebuild.LinuxBuildImage, cdk_image_name):
343344
return getattr(_codebuild.LinuxBuildImage, cdk_image_name)
344345
if specific_image.startswith('docker-hub://'):
@@ -393,9 +394,6 @@ def determine_build_image(codebuild_id, scope, target, map_params):
393394
specific_image.get('tag', 'latest'),
394395
)
395396

396-
if not specific_image:
397-
raise ValueError("Required CodeBuild image property is not configured")
398-
399397
return CodeBuild.get_image_by_name(specific_image)
400398

401399
@staticmethod

src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/schema_validation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
# CodeCommit Source
5959
CODECOMMIT_SOURCE_PROPS = {
60-
"account_id": AWS_ACCOUNT_ID_SCHEMA,
60+
Optional("account_id"): AWS_ACCOUNT_ID_SCHEMA,
6161
Optional("repository"): str,
6262
Optional("branch"): str,
6363
Optional("poll_for_changes"): bool,
@@ -308,7 +308,7 @@
308308
lambda x: PROVIDER_SOURCE_SCHEMAS[x['provider']].validate(x),
309309
),
310310
),
311-
'build': Or(
311+
Optional('build'): Or(
312312
And(
313313
{
314314
Optional("provider"): 'codebuild',

0 commit comments

Comments
 (0)