diff --git a/docs/providers-guide.md b/docs/providers-guide.md index 7645f6b3c..b3d14d4c4 100644 --- a/docs/providers-guide.md +++ b/docs/providers-guide.md @@ -228,7 +228,7 @@ Provider type: `codebuild`. #### Properties -- *image* *(String|Object)*. +- *image* *(String|Object)*. - default: `STANDARD_5_0` - It is required to specify the container image your pipeline requires. - Specify the Image that the AWS CodeBuild will use. Images can be found [here](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-codebuild.LinuxBuildImage.html). diff --git a/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_constructs/adf_codebuild.py b/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_constructs/adf_codebuild.py index b6112c10e..2ac44bf5d 100644 --- a/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_constructs/adf_codebuild.py +++ b/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/cdk/cdk_constructs/adf_codebuild.py @@ -22,6 +22,7 @@ ADF_DEPLOYMENT_REGION = os.environ["AWS_REGION"] ADF_DEPLOYMENT_ACCOUNT_ID = os.environ["ACCOUNT_ID"] +DEFAULT_CODEBUILD_IMAGE = "STANDARD_5_0" DEFAULT_BUILD_SPEC_FILENAME = 'buildspec.yml' DEFAULT_DEPLOY_SPEC_FILENAME = 'deployspec.yml' ADF_DEFAULT_BUILD_ROLE_NAME = 'adf-codebuild-role' @@ -338,7 +339,7 @@ def determine_build_spec(codebuild_id, default_props, target=None): @staticmethod def get_image_by_name(specific_image: str): - cdk_image_name = specific_image.upper() + cdk_image_name = (specific_image or DEFAULT_CODEBUILD_IMAGE).upper() if hasattr(_codebuild.LinuxBuildImage, cdk_image_name): return getattr(_codebuild.LinuxBuildImage, cdk_image_name) if specific_image.startswith('docker-hub://'): @@ -393,9 +394,6 @@ def determine_build_image(codebuild_id, scope, target, map_params): specific_image.get('tag', 'latest'), ) - if not specific_image: - raise ValueError("Required CodeBuild image property is not configured") - return CodeBuild.get_image_by_name(specific_image) @staticmethod diff --git a/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/schema_validation.py b/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/schema_validation.py index 3289db7f0..c8adcc0c1 100644 --- a/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/schema_validation.py +++ b/src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/schema_validation.py @@ -57,7 +57,7 @@ # CodeCommit Source CODECOMMIT_SOURCE_PROPS = { - "account_id": AWS_ACCOUNT_ID_SCHEMA, + Optional("account_id"): AWS_ACCOUNT_ID_SCHEMA, Optional("repository"): str, Optional("branch"): str, Optional("poll_for_changes"): bool, @@ -308,7 +308,7 @@ lambda x: PROVIDER_SOURCE_SCHEMAS[x['provider']].validate(x), ), ), - 'build': Or( + Optional('build'): Or( And( { Optional("provider"): 'codebuild',