Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/default codebuild image #787

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/providers-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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://'):
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -308,7 +308,7 @@
lambda x: PROVIDER_SOURCE_SCHEMAS[x['provider']].validate(x),
),
),
'build': Or(
Optional('build'): Or(
And(
{
Optional("provider"): 'codebuild',
Expand Down